Search code examples
androidalarmmanageralarm

Alarm for every day not working?


Well I have an alarm that should be called every day, but its not working. if I set it every minute it works, same for every hour. Here's my alarm call:

    try {
         Calendar cal = Calendar.getInstance();
         cal.add(Calendar.MILLISECOND, 1);
         Intent intent = new Intent(this, AlarmReceiver.class);
         intent.putExtra("alarm_toast", "Working");
         PendingIntent sender = PendingIntent.getBroadcast(this, 092809, intent, PendingIntent.FLAG_UPDATE_CURRENT);

         AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
         am.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 3600000*3, sender);
    } catch (Exception e1) {
        e1.printStackTrace();
    }

I have even hard coded the launching time, (currently testing it for 3600000*3 = 3 hours), but it also don't work for every day. What am I doing wrong?


Solution

  • Please check this thread. you may get solution.