android - when alarm fires, start an activity if app active or send notification if app not active -


in app want schedule alarm associated activity a. when alarm fires, should happen depends on circumstances:
1. if app not opened @ time, display notification in notification bar , start activity next time app started
3. if app active, start activity a

activity not background activity - requires user interaction.

ideally, same behavior work more 1 alarm - i.e. if 2 alarms fired while app not in use, 2 activities queued start once user starts app.

i read android docs on alarmmanager, pendingintents , notification - know how schedule alarm fires notification, don't know @ how go
- "queueing" of activities after alarm fires
- "conditional behavior" when alarm fires (based on whether app running or not).

it seems plenty of apps need kind of behavior. hope can point me in right direction.

found solution in "android programming: big nerd ranch guide" book (hardy & phillips). solution use intent service handles alarmmanager intents, , sends ordered broadcast. broadcast either received activity, or - outside of app lifetime - service, sends notification.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -