How to check if my app is allowed to show notification

后端 未结 6 1022
执念已碎
执念已碎 2020-12-05 06:49

In Android settings users can turn off notification if they don\'t want to. So is there any method that like isNotificationAllowed() to check is my app is allow

6条回答
  •  眼角桃花
    2020-12-05 07:07

    if(NotificationManagerCompat.from(context).areNotificationsEnabled())
    {
     //Do your Work
    }
    else
    {
         //Ask for permission
    }
    

提交回复
热议问题