I get stuck with something that , I guess , is very trivial.
Basically I am scheduling alarm for a given moment in the future :
Intent contentIntent = new Intent(this, AlarmReceiver.class);
PendingIntent theappIntent = PendingIntent.getService(Main.this, 0,contentIntent, 0);
Calendar calendar = Calendar.getInstance();
calendar.set(year, month, day, hour,minute);
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), theappIntent);
works fine while mobile is constantly on.
My problem is that alarm is not triggered after mobile is restarted
and is TURNED ON on the expected time.
Is there something I missed? Should I do some extra work to keep alarm
scheduled after restart?
You have to reset the alarm when device get boot.
You are missing to detect the app when device boot and reset the alarm..so below is code written in manifest
Also create a BroadcastReceiver to receive the boot completed intent