我想设置每天在不同时间触发的重复警报 [英] I want to set repeating alarm that triggers every day at different time

查看:93
本文介绍了我想设置每天在不同时间触发的重复警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要每天日出时触发警报。
我这样获得日出时间: 06:55

I need the alarm to be triggered every day at sunrise. I get the sunrise time like this:"06:55"

Location location = new Location(latitude, longitude);
SunriseSunsetCalculator calculator = new SunriseSunsetCalculator(location, "GMT"+localTime);
String officialSunrise = calculator.getOfficialSunriseForDate(Calendar.getInstance());

这意味着每天触发的时间会有所不同。

That means every day the time to trigger will be different.

alarms.setInexactRepeating(AlarmManager.RTC_WAKEUP, startmillis,intervalmillis, wakeUp); 

我希望能获得关于该走哪条路的一般指导。

I would appreciate general guidance on what direction to go.

推荐答案

而不是设置每天都会在不同时间响起的警报。您应该每天设置单独的警报。我建议您通过在闹钟响后设置第二天的闹钟来做到这一点。

Instead of setting an alarm that will go off at a different time each day. You should set separate alarms each day. I recommend you do this by setting the next days alarm after an alarm goes off.

这篇关于我想设置每天在不同时间触发的重复警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆