Turn off notifications of an app programatically on Android

淺唱寂寞╮ 提交于 2019-11-27 06:54:40

问题


I am developing a package manager application which shows checkboxes to turn off notifications from different applications installed on the Android device.

Since Android 4.1, users can turn off notifications of an app from application manager. Can I turn on/off notifications from an app programatically? Is there an API for doing that?


回答1:


No, you cannot do that from your code. Perhaps on rooted devices you could do some magic, but that shall not really count for wider audience.




回答2:


If you are App dev, you should manage that on server side, having a webservice (REST API) allowing the user to unsubscribe to the notifications. Then implement a Settings section in your App where user can uncheck a notification box and that call this service. Then, your server will not send the notification to this user.



来源:https://stackoverflow.com/questions/15819249/turn-off-notifications-of-an-app-programatically-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!