What is the best practice to create a scheduled notification at some point in the future?
I have found a way using a Service that is triggered with a PendingIntent via the AlarmManager. In the onCreate() method of the Service I create the notification. This seems a bit like abusing the service to do something it is not supposed to be doing.
Is there another less cumbersome / more elegant method of achieving the same end? (The use case in question is giving the user a daily reminder to do something with my app)
AlarmManager.Ummm…why?
Setting an alarm requires a total of 3 to 4 Java statements, plus one for any extra you package into the
Intent. Processing the alarm in aBroadcastReceiverto go raise aNotificationregarding the “daily reminder” should be another ~20 lines of code, plus one entry in the manifest.