I am trying to start an alarm service that repeats every day at a particular time. I have gone through a lot of threads on stack overflow regarding this but no luck. I followed
Here is what I did to get it working:
1) Added <uses-permission android:name="com.android.alarm.permission.SET_ALARM"/>
to my manifest file.
2) Changed code in my Main activity to:
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR, 3);
calendar.set(Calendar.MINUTE, 29);
calendar.set(Calendar.AM_PM, Calendar.PM);
Intent myIntent = new Intent(this, MyReceiver.class);
pendingIntent = PendingIntent.getBroadcast(this, 0, myIntent,0);
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
AlarmManager.INTERVAL_DAY, pendingIntent);
Hope someone finds this helpful!