Reputation:
i am setting alarm like this
AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
alarm.setRepeating(AlarmManager.RTC_WAKEUP,enter code here
calendar1.getTimeInMillis(), 24*60*60 * 1000, pintent);
and i am using this for getting next alarm time but it gives me next alarm time of default device alarmApp.
android.provider.Settings.System.getString(
getContentResolver(),
android.provider.Settings.System.NEXT_ALARM_FORMATTED)
so what to do to get next alarm set by me ........
Upvotes: 6
Views: 2280
Reputation: 11
After setting your alarm just put date/time of your alarm (in String format) into Settings.System. :
Settings.System.putString(getContentResolver(),
Settings.System.NEXT_ALARM_FORMATTED, "Your custom date/time of your alarm in String");
Remember to check if your new created alarm would be for sure the next alarm, because in Settings you can store only one String (it is replaced).
Upvotes: 0
Reputation: 9212
Unfortunately you can't read any information about the current alarms from the Alarm Manager, even if you set it yourself.
That means, you'll have to keep track of your alarm separately as a shared preference.
Upvotes: 1