How to cancel Android notifications?

后端 未结 2 1102
长情又很酷
长情又很酷 2020-12-03 19:42

I am making an app where the user can set an alarm based on GPS location. I only want 1 alarm to be active at any one time. So, when the user sets a 2nd alarm, I want to can

2条回答
  •  爱一瞬间的悲伤
    2020-12-03 20:21

    You need to make sure you are always referencing the same instance of your NotificationManager. Different instances will produce different notifications. I'd recommend using a service to manage notifications.

    http://developer.android.com/guide/topics/fundamentals.html

提交回复
热议问题