android - start repeating alarm from AlarmManager -


i want start service every day 8am 6pm. using 3 alarms.

  1. for starting alarm2 everyday @ 8am.
  2. for starting service every 1 min.
  3. to stop alarm2.

is proper way? unable start alarm2 alarm1.

this code alarm 1:

    public class alarmreceiver1 extends broadcastreceiver {         int interval;         @override         public void onreceive(context context, intent intent) {             alarmmanager manager = (alarmmanager) context.getsystemservice(context.alarm_service);             intent in=new intent(this,alarmreceiver2);             pendingintent startingintent = pendingintent.getbroadcast(context, 0,in, 0);              long duration = interval * 60 * 1000;             manager.setrepeating(alarmmanager.rtc_wakeup,timeon.gettimeinmillis(), 86400000,startingintent);         } } 

far enough code tell if has been set properly. there example here on how should set alarmmanager. i'd recommend looking through if there you've missed.

also can see in example gotta reset alarms every time phone rebooted. if don't services not run.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -