开发者

How to disable a click event of notification in android development

as we know , we can append pendingintent to the notification so if we click the notification we can run the intent , start a activity ,service or broadcast

so if I want to disable the click event of the notification ,How can I do ?

make a class 开发者_JAVA百科extends notification? is there some param in the notification manager to disable it ?


Use Intent intent = new Intent() and insert this into the PendingIntent.


This is not direct answer, but you shouldn't disable click on notification. This will result in poor user experience, as user will not be able to navigate to your application and/or cancel what you're doing. This may frustrate user, as he or she may not even know what application is the source of this notification and won't be able to easily understand how to remove this notification (if its ongoing).


As per CommonsWare's answer to my duplicate question, this is not possible. The notification manager is part of the firmware, and we cannot control that part of its behaviour.

see: Android Notification without click event?


Check this answer. I think you should use setAutoCancel(false) method from NotificationCompat.Builder.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜