Notifications 如何动态获取android应用程序的通知状态

Notifications 如何动态获取android应用程序的通知状态,notifications,android-push-notification,Notifications,Android Push Notification,我们在android中实现了一个聊天应用程序,当用户不想收到任何通知时 he will turn off the notification in settings of the app , 但是如何在android编程中获得“通知状态”(开/关),以防止向关闭的用户发送通知,从而节省向用户发送通知的费用……在我搜索了很多之后。。。。我在这里找到了获取应用程序通知状态的解决方案: 使用 使用支持库中的NotificationManagerCompat.from(Context).arN

我们在android中实现了一个聊天应用程序,当用户不想收到任何通知时

     he will turn off the notification in settings of the app ,

但是如何在android编程中获得“通知状态”(开/关),以防止向关闭的用户发送通知,从而节省向用户发送通知的费用……

在我搜索了很多之后。。。。我在这里找到了获取应用程序通知状态的解决方案: 使用

使用支持库中的NotificationManagerCompat.from(Context).arNotificationsEnabled()检查API 19+上是否阻止了通知。API 19以下的版本将返回true(启用通知)

有关更多详细信息,请访问此链接:

 NotificationManagerCompat.from(context).areNotificationsEnabled()