开发者

AlarmManager & NEXT_ALARM_FORMATTED

I am setting alarams as follows:

 AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE);

   开发者_开发问答 alarm.setRepeating(AlarmManager.RTC_WAKEUP,
            calendar1.getTimeInMillis(), 24*60*60 * 1000, pintent);

Like this i am adding so many alarms with different time intervals.

So now i want to get next alarm time out of these.

For that i am using

  android.provider.Settings.System.getString(
                    getContentResolver(),
                    android.provider.Settings.System.NEXT_ALARM_FORMATTED)

but the above is not returning any thing.

Pls some body help me ..


Settings.System.NEXT_ALARM_FORMATTED returns the next alarm of your clock, like it is shown on the lockscreen.

The AlarmManager does not provide methods for the next execution. If your using AlarmManager.setInexactRepeating() (saves battery!) it won't be possible to determine the exact time anyway.

Why don't you store the execution time in SharedPreferences or a database when you're scheduling an alarm?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜