Now, Your Friends Are Alarmed
package="apt.tutorial.two"
android:versionCode="1"
android:versionName="1.0">
android:label="@string/app_name">
OnAlarmReceiver tells WakefulIntentService to sendWakefulWork(), which will:
•
Acquire a static WakeLock, then
•
Call startService() on our PostMonitor service
This means all WakeLock management can be encapsulated in
WakefulIntentService.
Step #3: Doing the Work
Now, we need to arrange for PostMonitor to respond to those polling
Intents.
First, change PostMonitor to have it extend WakefulIntentService, adding an
import for com.commonsware.cwac.wakeful.WakefulIntentService.
291
Subscribe to updates at http://commonsware.com
Special Creative Commons BY-NC-SA 3.0 License Edition
package="apt.tutorial.two"
android:versionCode="1"
android:versionName="1.0">
OnAlarmReceiver tells WakefulIntentService to sendWakefulWork(), which will:
•
Acquire a static WakeLock, then
•
Call startService() on our PostMonitor service
This means all WakeLock management can be encapsulated in
WakefulIntentService.
Step #3: Doing the Work
Now, we need to arrange for PostMonitor to respond to those polling
Intents.
First, change PostMonitor to have it extend WakefulIntentService, adding an
import for com.commonsware.cwac.wakeful.WakefulIntentService.
291
Subscribe to updates at http://commonsware.com
Special Creative Commons BY-NC-SA 3.0 License Edition
