Android notifications multiple times

前提是你 提交于 2019-12-06 14:10:57

The second parameter in your PendingIntent.getBroadcast known as the request code needs to be unique for each new alarm, otherwise it will overwrite. It says in the documentation that this requestCode is not currently used. The documentation is wrong.

you have

PendingIntent pIntent = PendingIntent.getBroadcast(this, 0, _intent, PendingIntent.FLAG_ONE_SHOT); am.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + millisecDiff, pIntent);

What you want is

PendingIntent pIntent = PendingIntent.getBroadcast(this, SomeUniqueIndex, _intent, PendingIntent.FLAG_ONE_SHOT); am.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + millisecDiff, pIntent);

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