i using alarm manger start service @ particular time working fine, if user changes device time service started according time.
i know there lots of question on stack overflow none of them working me
here's code
calendar = new gregoriancalendar(); calendar.settimeinmillis(system.currenttimemillis()); cal = new gregoriancalendar(); cal.add(calendar.day_of_year, calendar.get(calendar.day_of_year)); cal.set(calendar.hour_of_day, 11); cal.set(calendar.minute, 57); cal.set(calendar.second, calendar.get(calendar.second)); cal.set(calendar.millisecond, calendar.get(calendar.millisecond)); cal.set(calendar.date, calendar.get(calendar.date)); cal.set(calendar.month, calendar.get(calendar.month)); alarmmanager alarmmanager = (alarmmanager)getsystemservice(alarm_service); intent = new intent(mainactivity.this,start_service_alarm.class); it.putextra(start_service_alarm.action, start_service_alarm.action); pendingintent pendingintent = pendingintent.getbroadcast(mainactivity.this, 0, it, 0); alarmmanager.setrepeating(alarmmanager.rtc_wakeup, cal.gettimeinmillis(), alarmmanager.interval_day, pendingintent);
please me important me.
the device knows set time (which can automatically determined external internet or mobile network source, can overridden user).
you need have external time provider application syncs with, sending location server can determine correct time zone.
there apis available, e.g.: http://timezonedb.com/api, or roll own
Comments
Post a Comment