Multiple alarms at the same time in Android

為{幸葍}努か 提交于 2019-12-02 04:27:53
if (alarmRun == false){
          PendingIntent pending = PendingIntent.getBroadcast(this.context, 0, alarm, 0);
          AlarmManager alarmMgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
                    alarmMgr.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(), 15000, pending);
            }

Calling setRepeating will cause the BroadcastReceiver to be triggered multiple times at an interval of 15000 milliseconds. Use setExact instead.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!