notifications - AlarmManager Interval for Android -


this code have far

alarmmanager = (alarmmanager) getsystemservice(context.alarm_service); setrepeatingalarm();  public void setrepeatingalarm() {      calendar cal = calendar.getinstance();     cal.add(calendar.second, 10);      intent intent = new intent(this, timealarm.class);     pendingintent pendingintent = pendingintent.getbroadcast(this, 0, intent, pendingintent.flag_cancel_current);     am.setrepeating(alarmmanager.rtc_wakeup, cal.gettimeinmillis(), (15 * 1000), pendingintent);   }  } 

this trying accomplish: alarm not turn on until 30 seconds past every minute. once clear it, wont comes on until 30 seconds past next minute. if open app, , 25 second past minute, activate status bar notification 5 second later. if 40 seconds past, have wait 50 more seconds (into next minute). not sure how use calendar function attain this?

if understand requirement try following...

calendar cal = calendar.getinstance(); if (cal.get(calendar.second) >= 30)     cal.add(calendar.minute, 1); cal.set(calendar.second, 30);  // intent , pendingintent stuff  am.setrepeating(alarmmanager.rtc_wakeup, cal.gettimeinmillis(), 60 * 1000, pendingintent); 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -