I have set the alarm to remind me in android it is working when the device is on. But when i switch off the device and again on that reminder alarm is not working. Can you guys please suggest me how can solve this problem?
My code looks like this,
Intent myIntent = new Intent(getApplicationContext(), serviceclass.class);
PendingIntent pendingIntent = PendingIntent.getService(getApplicationContext(),
CONST+id, myIntent, PendingIntent.FLAG_UPDATE_CURRENT);
Calendar calender = Calendar.getInstance();
calender.setTimeInMillis(System.currentTimeMillis());
calender.set(Calendar.HOUR_OF_DAY, hours);
calender.set(Calendar.MINUTE, ireminder.getMin());
calender.set(Calendar.SECOND, 0);
calender.set(Calendar.MILLISECOND, 0);
calender.set(Calendar.DAY_OF_WEEK, day);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
calender.getTimeInMillis(), 7 * AlarmManager.INTERVAL_DAY, pendingIntent);
Alarms will be cleared on reboot.
What you can do is
REBOOT_COMPLETED
-EventSee API: "Registered alarms are retained while the device is asleep (and can optionally wake the device up if they go off during that time), but will be cleared if it is turned off and rebooted." - http://developer.android.com/reference/android/app/AlarmManager.html
Create a class OnBootReceiver
inside manifest
inside your activity