This article is entitled : Developing for Android VII The Rules: Framework - Basically going over Android specific APIs, how to use them, and how not to re-architect what is already there.
tl;dr : If Android framework provides a way to interact with interact with the operating system, use them (based on particular semantics with the OS). - Just read this one it is short enough..
- Activities : top-level UI entry point into your app, there can be many entry points. Use activities when you want others (internal components / 3rd party apps) to launch specific portions of your app.
- Service : This component tells the OS you need a longer running operation outside UI. Can be self running, running on behalf of others.. If you don't need that, use AsyncTask, Loader, HandlerThread. Also note that AsyncTask does not play as well with Activity lifecycle as a Loader. Oh also, checkout IntentService too - not covered by this article, but something I wanted to point out.
- Services should be bound or started (NOT BOTH)
- Use services for processes with state and on-going lifecycle.
- Broadcast Receiver : how applications can advertise they want to be notified of system events
- Use broadcasts for delivering independent events
- Don't pass large objects over binder (say a huge bitmap - send a URI to that bitmap instead).
- Isolate UI from Background - think of music app w/ background service actually playing the music.
Thats it, kind of a short article. Probably good to just read it over, can't wait to see what is next..
No comments:
Post a Comment