1

In the android application that I am developing, I have to create repeating alarms with interval as daily for four timings.

8am, 1pm, 5pm and 9pm

PendingIntent pi = PendingIntent.getBroadcast(
                context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
getAlarmMgr().setRepeating(AlarmManager.RTC_WAKEUP,
                    triggerTimeInMillis, AlarmManager.INTERVAL_DAY  , pi);

The above code is repeated for setting alarms for 8am, 1pm, 5pm and 9pm

The behavior is different in different phones. In MotoG, I am getting all the alarms, in nexus6 I am getting alarms only for two timings(1pm,5pm). In xiaomi and sony phones, I am not at all getting alarms.

Please help me to solve this issue so that it will work in all the phones.

Sumi
  • 11
  • 1
  • 1
    Alarms are dispatched different on different platforms which are differentiated by API. In particular you need to code different till API 18 and different on API 19 and above. You can use the following technique: `if(Build.VERSION.SDK_INT >= 19) { alarmManager.setExact(AlarmManager.RTC_WAKEUP, trigger_time, pendingIntent); } else { alarmManager.set(AlarmManager.RTC_WAKEUP, trigger_time, pendingIntent); }` – Skynet Dec 04 '15 at 12:17

0 Answers0