Is there any way to check if an alarm is already set?

前端 未结 4 949
情深已故
情深已故 2020-12-08 00:41

I am stuck. When my application starts I want to check if an alarm is alive that I previously set. If not then I want to set it.

I referred to this solution. I am

4条回答
  •  暖寄归人
    2020-12-08 01:10

    Basiclly from my experiance if you use the same Intent and FLAG_UPDATE_CURRENT, you can be sure that you won't have two alarm set for the same intent. Also you can look closely at FLAG_NO_CREATE which is used with get functions and returns null if pendingintent with described intent already exists.

    Also remember to use the same request id for pending intent as their are distinguishable.

提交回复
热议问题