I want to trigger a notification in the status bar every x days(that the user will define in the application). How can i code this ? Thank you.
Asked
Active
Viewed 536 times
2 Answers
2
AlarmManager was designed for stuff like that.

mibollma
- 14,959
- 6
- 52
- 69
-
Is there please some samples ? – androniennn Aug 14 '11 at 16:54
0
Assuming you already know how to code an android app, you can see these pages for code examples:
- To trigger a notification in the status bar: http://developer.android.com/guide/topics/ui/notifiers/notifications.html
- To run the trigger evey x days, you can use AlarmManager: http://developer.android.com/reference/android/app/AlarmManager.html

Sheepy
- 17,324
- 4
- 45
- 69
-
1The problem is there is just this parameters: INTERVAL_DAY INTERVAL_FIFTEEN_MINUTES INTERVAL_HALF_DAY INTERVAL_HALF_HOUR INTERVAL_HOUR. There is no customized value. – androniennn Aug 14 '11 at 16:56
-
1Aha. Well they are constants. So for example if you need two days you say 2*INTERVAL_DAY, if you need 3.5 days you say 3.5*INTERVAL_DAY. – Sheepy Aug 14 '11 at 17:01
-
Okay. And i've found this topic http://stackoverflow.com/questions/1082437/android-alarmmanager and i don't know what OnAlarmReceiver.class contains :\. Any idea please ? – androniennn Aug 14 '11 at 17:07
-
From the look of it, it extends BroadcastReceiver and overrides the onReceive method to run something - status bar notice in your case. Here is a more detailed explaination of how to use AlarmManager: http://www.vogella.de/articles/AndroidServices/article.html#pendingintent – Sheepy Aug 14 '11 at 17:19