Note that there are some explanatory texts on larger screens.

plurals
  1. POAlarmManager responding at wrong time
    primarykey
    data
    text
    <p>Sorry if answered before, but i looked everywhere but didn't get the proper solution</p> <p>I am using AlarmManager to automatically fire a notification at 9am everyday, but when i try to run it on emulator it executes immediately, and every half hour (31-32min to be precise) after that instead of only once at 9am everyday.</p> <p>Any ideas why? help appreciated.</p> <p>code is as below:</p> <pre><code>public class Home extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_bsheet); notificationAlert(savedInstanceState); } private void notificationAlert(Bundle savedInstanceState) { AlarmManager manager; PendingIntent pendingIntent; Intent intent=new Intent(Home.this, Notify.class); manager=(AlarmManager)getSystemService(ALARM_SERVICE); pendingIntent=PendingIntent.getService(Home.this, 0, intent, 0); GregorianCalendar gcal = new GregorianCalendar(); gcal.set(Calendar.HOUR_OF_DAY, 9); gcal.set(Calendar.MINUTE, 0); gcal.set(Calendar.SECOND, 0); gcal.set(Calendar.MILLISECOND, 0); long initTime = gcal.getTimeInMillis(); manager.setRepeating(AlarmManager.RTC_WAKEUP, initTime, 24*60*60*1000, pendingIntent); } } </code></pre> <p>cheers,</p> <p><strong>EDIT:</strong> my intention is that, once the app is installed, it fires this alarm at 9am. i have put the alarm in the onCreate, so im not sure if the alarm is only being created everytime i start the app and something weird is happening when i hide the app... again insight would be appreciated!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload