开发者

how to capture the clear event when clear button is pressed in notification bar in android

HI, in Android when the clear button is pressed on the notification screen i want to capture that in 开发者_如何学JAVAmy application and do some stuff. please help me in how to achieve this.


Add a deleteIntent to your Notification.


in my code i already have contentIntent and now after adding the deleteintent , when i m pressing the clear button contentintent things are getting executed. Intent noti=new Intent(context, MyService.class); noti.putExtra("key1", true); contentIntent = PendingIntent.getService(context, 0, noti, 0); Intent stopIntent = new Intent(context, Myervice.class); notificationIntent.putExtra("Key2", true); PendingIntent deleteIntent = PendingIntent.getService(context, 0, stopIntent, 0); now when i m pressing the clear key i m getting the key1 and key 2 both

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜