android alarmmanager multiple alarms, one overwrites the other?

前端 未结 1 1273
北荒
北荒 2021-02-02 14:00

I\'ve searched posts for answers to my question but haven\'t found anything that solves my problem. I\'m trying to set 3 different alarms using one AlarmSettings class. When I

1条回答
  •  鱼传尺愫
    2021-02-02 14:46

    PendingIntent pendingIntent1 = PendingIntent.getActivity(getApplicationContext(), 0, intent1, PendingIntent.FLAG_ONE_SHOT);
    

    change the 0 attribute to an id for your alarm, for example you have three alarms,

    repeat the above code with 0,1,2.

    this way they won't override each other.

    0 讨论(0)
提交回复
热议问题