I have a database in which the user saves the things that he wants to do.In each thing he can set a date of expiration.the point is, I want to create a list(notification list) where the "things to do" that are going to expire will appear. for example the user wants to create a list with the things that are going to expire in two days. I have used the IntentService and pass with the intent the time that the user selects each time but i get nothing. do I have to use service or bound service in this case? thank you in advance
Asked
Active
Viewed 93 times
0
-
You can use "Alarm Manager" and "Broadcast Receiver". – Anil Jadhav Oct 18 '12 at 09:32
2 Answers
0
you can use AlarmManager class to fire off events at given times and in these events you can use NotificationManager to trigger the notifications.
See alarm manager example here: Alarm Manager Example
See notifications guide here: https://developer.android.com/guide/topics/ui/notifiers/notifications.html

Community
- 1
- 1

Anup Cowkur
- 20,443
- 6
- 51
- 84
-
well,I ve thought of these options but I decided to work on it this way. I need to have a list.I havent figures out the differernce between the bound service and a simple service,so thats why I ask if I have to use another type of service to run in background – user1347280 Oct 18 '12 at 09:37
0
Use the AlarmManager technique as like,..
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, yearFromDB);
calendar.set(Calendar.MONTH, monthFromDB);
calendar.set(Calendar.DAY_OF_MONTH, dateFromDB);
calendar.set(Calendar.HOUR_OF_DAY, hourFromDB);
calendar.set(Calendar.MINUTE, minuteFromDB);
calendar.set(Calendar.SECOND, 0);
Use PendingIntent for the Wake up at the Specific time and perform this Task..
alarmManager.set(AlarmManager.RTC_WAKEUP,calendar.getTimeInMillis(), ObjPendingIntent);
You can get the to do list on the Particular Time, Read on the PendingIntents and Alarmmanager by the following links..
http://developer.android.com/reference/android/app/PendingIntent.html
and
http://developer.android.com/reference/android/app/AlarmManager.html

gowri
- 681
- 9
- 27