Posts Tagged Gingerbread
The Android Thread Police are coming….
Posted by Stephen Downey in Android on December 14, 2010
As part of the Gingerbread release of android, a new API, StrictMode will allow developers to set a policy on a thread.
StrictMode is most commonly used to catch accidental disk or network access on the application’s main thread, where UI operations are received and animations take place. Keeping disk and network operations off the main thread makes for much smoother, more responsive applications. By keeping your application’s main thread responsive, you also prevent ANR dialogs from being shown to users.
StrictMode will only come into play if you select it and allows you to detect the following situations:
- detect disk writes
- detect disk reads
- detect network usage
- on a violation: log
- on a violation: crash
- on a violation: dropbox
- on a violation: show an annoying dialog
Enabling StrictMode
StrictMode can be enabled in your applications onCreate method
public void onCreate() { if (DEVELOPER_MODE) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() .detectDiskReads() .detectDiskWrites() .detectNetwork() .penaltyLog() .build()); } super.onCreate(); }
This blog post on the Android Developers blog by Brad Fitzpatrick will give you an overview of what you can expect. You can also check out the StrictMode API here for more details on what it allows.
Android 2.3 (Gingerbread) is the fastest Android yet and out now
Posted by Stephen Downey in Android on December 6, 2010
Google have release Android 2.3 today and they are claiming that it is the fastest version yet. From a performance point of view, there is now Concurrent garbage collector, Faster event distribution and Updated video drivers. It looks like they are trying to push into the gamers market with many of these new features.
Here is an overview of the main features of Android 2.3 from the Google release:
Enhancements for game development: To improve overall responsiveness, we’ve added a new concurrent garbage collector and optimized the platform’s overall event handling. We’ve also given developers native access to more parts of the system by exposing a broad set of native APIs. From native code, applications can now access input and sensor events, EGL/OpenGL ES, OpenSL ES, and assets, as well a new framework for managing lifecycle and windows. For precise motion processing, developers can use several new sensor types, including gyroscope.
Rich multimedia: To provide a great multimedia environment for games and other applications, we’ve added support for the new video formats VP8 and WebM, as well as support for AAC and AMR-wideband encoding. The platform also provides new audio effects such as reverb, equalization, headphone virtualization, and bass boost.
New forms of communication: The platform now includes support for front-facing camera, SIP/VOIP, and Near Field Communications (NFC), to let developers include new capabilities in their applications.
See what applications are running
One personal gripe of mine has been the low battery time on Android. I recently upgraded my Xperia X10 to 2.1 and found the battery to last a bit longer but 2.3 has addressed the problem as well. As you can see from this screenshot, there is now a “Running” tab that allows you to see what applications are running. From here you can choose to close the app or report feedback to its developer.
Near Field Communications (NFC)
One of the new features that I am really excited about is Near Field Communications that allows the device to read NDEF tags. This is going to allow for the development of a whole host of applications. The obvious one being, “Swipe to pay” applications that will allow you to pay for goods using an app on your android device.
An NFC Reader application lets the user read and interact with near-field communication (NFC) tags. For example, the user can “touch” or “swipe” an NFC tag that might be embedded in a poster, sticker, or advertisement, then act on the data read from the tag. A typical use would be to read a tag at a restaurant, store, or event and then rate or register by jumping to a web site whose URL is included in the tag data. NFC communication relies on wireless technology in the device hardware, so support for the platform’s NFC features on specific devices is determined by their manufacturers.
Checkout the video below for an overview of all of the new features:
For more information about Android 2.3 visit the Platform Highlights page.