Skip to content

Commit

Permalink
Merge branch 'master' of github.com:commonsguy/cwac-wakeful
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Murphy committed Dec 5, 2011
2 parents a96bd20 + 78c0de1 commit 12c5b1b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions README.markdown
Expand Up @@ -66,10 +66,10 @@ Alarm Usage
If you want to slightly simplify your use of `WakefulIntentService`
in conjunction with `AlarmManager`, you can do the following:

1. Implement your `WakefulIntentService` and `doWakefulWork()`
First, implement your `WakefulIntentService` and `doWakefulWork()`
as described above.

2. Create a class implementing the `WakefulIntentService.AlarmListener`
Next, create a class implementing the `WakefulIntentService.AlarmListener`
interface. This class needs to have a no-argument public constructor
in addition to the interface method implementations. One method
is `scheduleAlarms()`, where you are passed in an `AlarmManager`,
Expand All @@ -83,15 +83,15 @@ not seen an alarm go off, we should assume that the alarms were
canceled (e.g., application was force-stopped by the user), and
should reschedule them.

3. Create an XML metadata file where you identify the class
Then, create an XML metadata file where you identify the class
that implements `WakefulIntentService.AlarmListener` from the
previous step, akin to:

<WakefulIntentService
listener="com.commonsware.cwac.wakeful.demo.AppListener"
/>
<WakefulIntentService
listener="com.commonsware.cwac.wakeful.demo.AppListener"
/>

4. Register `com.commonsware.cwac.wakeful.AlarmReceiver`
Next, register `com.commonsware.cwac.wakeful.AlarmReceiver`
as a `<receiver>` in your manifest, set to respond to
`ACTION_BOOT_COMPLETED` broadcasts, and with a `com.commonsware.cwac.wakeful`
`<meta-data>` element pointing to the XML resource from
Expand All @@ -107,9 +107,9 @@ the previous step, akin to:
android:resource="@xml/wakeful"/>
</receiver>

5. Add the `RECEIVE_BOOT_COMPLETED` permission to your manifest.
Also, add the `RECEIVE_BOOT_COMPLETED` permission to your manifest.

6. When you wish to manually set up the alarms (e.g., on
Finally, when you wish to manually set up the alarms (e.g., on
first run of your app), create an instance of your `AlarmListener`
and call `scheduleAlarms()` on the `WakefulIntentService`
class, passing in the `AlarmListener` and a `Context` (e.g.,
Expand Down

0 comments on commit 12c5b1b

Please sign in to comment.