Reputation: 1358
I have a few questions regarding the WakefulIntentService implementation by CWAC:
1) Is it safe to use multiple WakefulIntentServices at the same time within my application?
2) Is it still ok to use my own code that handles AlarmManager? This would save me re-implementing my alarm handling code. Currently, I have a class with static methods and variables which are used by other classes within the application to set the alarm. My AlarmReceiver then starts the WakefulIntentServices by classing doWakefulWork().
This class is fantastic work!
Thanks
Upvotes: 0
Views: 587
Reputation: 1006564
Is it safe to use multiple WakefulIntentServices at the same time within my application?
You should only need one. Use different Intent
information (e.g., actions, extras) to distinguish the different commands.
I have not tried multiple distinct services -- while it is possible that it will work, I cannot guarantee it.
Is it still ok to use my own code that handles AlarmManager?
Oh, sure. Follow the "Basic Usage" instructions, calling sendWakefulWork()
on WakefulIntentService
when you want the work to be done. Just bear in mind that you must do that from a BroadcastReceiver's
onReceive()
if AlarmManager
is the trigger -- that's an AlarmManager
requirement.
This class is fantastic work!
I am glad that you like it!
Upvotes: 3