How to repeat alarm from 8 AM to 10 PM android -


I want to make an app that comes in every hour from 8 AM to 10 PM, how can I do this here Repeatable alarm after every one hour

  AlarmManager AM = (alarm manager) context.getSystemService (Context.ALARM_SERVICE); Intent to intent = new intent (reference, alarmmanagerbraska receiver square); Intent.putExtra (ONE_TIME, Boolean FALSE); Pending identification Pi = pending INT.getBroadcast (reference, 0, intent, 0); // 5 seconds later.Resolution (AlarmManager.RTC_wekup, System.contentime millise (), 1000 * 60 * 60, PI);  

The only way to set an alarm in the fire once in just one hour and your desired start And awareness time against expiration time.

There is another way to do this, but to shut down the alarm at 10:00 and set one for 8AM instead. Then again until noon till noon.

Edit:

You can compare time by using something like this:

  import android.text.format. Time; ... personal static final end START_HOUR = 10; Private Stable Final EndEND_HOUR = 22; ... now time = new time (); Now.setToNow (); Int hour = now.hour; If (hours> = START_HOUR & amp; hours    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -