Pro Android 5 by MacLean Dave & Komatineni Satya & Allen Grant

Pro Android 5 by MacLean Dave & Komatineni Satya & Allen Grant

Author:MacLean , Dave & Komatineni, Satya & Allen, Grant
Language: eng
Format: epub
ISBN: 978-1-4302-4680-0
Publisher: Apress
Published: 2015-06-09T16:00:00+00:00


Exploring Long-Running Broadcast Service Abstraction

WakefulIntentService is a good abstraction. However, we want to go a step further so that our abstraction parallels the method of extending IntentService as in Listing 16-7 and does everything that an IntentService does but also provides few more benefits:

Pass the original intent that was passed to the broadcast receiver to the overridden method onHandleIntent. This allows us to largely hide the broadcast receiver, simulating a programming experience that a service is started in response to a broadcast message. This is really the goal for this abstraction while some extras are thrown in.

Acquire and release wake locks (similar to WakefulIntentService).

Deal with a service being restarted.

Allow a uniform way to deal with the wake lock for multiple receivers and multiple services in the same process.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.