views:

48

answers:

1

I'm writing an app, that lets users subscribe to notification for TV transmissions. Currently the user can choose email, sms or push, but it all feels a bit overkill for a simple timed notification.

I wonder if I can tell Android to simply "show this Notification at 11:30"?

+3  A: 

I wonder if I can tell Android to simply "show this Notification at 11:30"?

If by "Notification" you mean Notification, then you can use AlarmManager for that. Set an alarm to go off at 11:30, and have your BroadcastReceiver that processes the alarm's PendingIntent raise the Notification. However, Notification doesn't send emails, SMSes, etc.

CommonsWare
Yes, I do mean just showing a 'Notification'. I read about AlaramManager, but it seams it will clear out if the user restarts the phone. That probably wouldn't be intuitive if the reminder is a few days in the future. Thus to work, I'd need a way to restart my Alaram on system start-up. Could that be possible?
Thomas Ahle
@Thomas Ahle: Absolutely. You will need to watch for the `BOOT_COMPLETED` broadcast and re-establish your alarm(s) at that point. Here is an example of getting control at boot time: http://github.com/commonsguy/cw-advandroid/tree/master/SystemEvents/OnBoot/
CommonsWare
Sure it's possible. Create another BroadcastReceiver that listens for phone boot up (http://stackoverflow.com/questions/3353311/andriod-how-to-autorun-an-application-when-the-phone-is-switched-on/3353651#3353651) and save your state onDestroy() and load your state onCreate()!
ekawas
Sweet, I believe that is all the pieces I need. Thanks to both of you :)
Thomas Ahle