Policing Android Apps With New Gingerbread API: StrictMode
#Gingerbread #Strictmode, #policedroid
Just like the article on ext4 on Gingerbread, Android developer blog is continuing the series of articles for the developer on Android 2.3, Gingerbread.
The latest is about improving performance by policy (ing) your app with the help of a new API introduced with Gingerbread, strictmode.
Since by default everything is allowed, developers are to set policy on thread what is not allowed to do on the particular thread. Some of the flags you can enable in the thread policy include:
(yes you are still bound to disk, even on diskless Android phones. You can't depend on the fast flash or filesystem to take care of traffic management. The original article has better explanation of disks on the phones and two good links explaining the phenomena.)
On Android devices, the main thread (UI Thread) takes care of callbacks and lifecycle events making it easier on the developers. But at the same time we need to realize, a bunch of others are also using the main thread to do animations, scrolls, and also flings process their animations by callbacks on the main thread. That is a lot of traffic and certainly need policy (ing) the traffic.
The article tells us of 16ms window we have to react to events that occur on the main thread and if you do not respond in time, your app will stutter, like I do when too many inputs clobber my senses.
So things like network requests on the main thread is discouraged and actually will be prohibited with the upcoming Honeycomb release. So better start getting ready for Honeycomb SDK, or at least put a big yellow note on what ever you put yellow notes on.
The recommended way to utilize strictmode is to enable it during the development cycle, learn and address what ever the bottlenecks you encounter, and turn it off before you ship your app or the game.
There are more tips on how to use strictmode to your advantage, follow on to New Gingerbread API: StrictMode
Thanks Brad Fitzpatrick,I leaned a lot today.
http://snapvoip.blogspot.com/
Just like the article on ext4 on Gingerbread, Android developer blog is continuing the series of articles for the developer on Android 2.3, Gingerbread.
The latest is about improving performance by policy (ing) your app with the help of a new API introduced with Gingerbread, strictmode.
Since by default everything is allowed, developers are to set policy on thread what is not allowed to do on the particular thread. Some of the flags you can enable in the thread policy include:
- 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
(yes you are still bound to disk, even on diskless Android phones. You can't depend on the fast flash or filesystem to take care of traffic management. The original article has better explanation of disks on the phones and two good links explaining the phenomena.)
On Android devices, the main thread (UI Thread) takes care of callbacks and lifecycle events making it easier on the developers. But at the same time we need to realize, a bunch of others are also using the main thread to do animations, scrolls, and also flings process their animations by callbacks on the main thread. That is a lot of traffic and certainly need policy (ing) the traffic.
The article tells us of 16ms window we have to react to events that occur on the main thread and if you do not respond in time, your app will stutter, like I do when too many inputs clobber my senses.
So things like network requests on the main thread is discouraged and actually will be prohibited with the upcoming Honeycomb release. So better start getting ready for Honeycomb SDK, or at least put a big yellow note on what ever you put yellow notes on.
The recommended way to utilize strictmode is to enable it during the development cycle, learn and address what ever the bottlenecks you encounter, and turn it off before you ship your app or the game.
There are more tips on how to use strictmode to your advantage, follow on to New Gingerbread API: StrictMode
Thanks Brad Fitzpatrick,I leaned a lot today.
http://snapvoip.blogspot.com/
0 comments:
Post a Comment