Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I check if push notifications were disabled in React Native using PushNotificationIOS?

Tags:

react-native

I'd like to determine if push notifications were disabled by a user using React Native with PushNotificationIOS.

PushNotificationIOS has the method checkPermissions, but this method only tells me whether notifications are enabled.

I would like, using React Native, to tell if my app prompted the user to enable notifications and the user denied the permission, or if the user independently went to settings and disabled notifications.

In native code, you'd use UNUserNotificationCenter and check getNotificationSettings for authorizationStatus with value .denied.

Thanks.

like image 825
Eric Conner Avatar asked Apr 04 '18 01:04

Eric Conner


People also ask

How do I turn off notifications in React Native?

you need to check platform and do the configuration respectively. For Android to check notification status you need react-native-permissions library. import {checkNotifications} from 'react-native-permissions'; Depending on the notification you can enable and disable the button.


1 Answers

I can suggest to you try this library. This library have all features that you mention above. For me it's work great, hope for you too.

like image 99
savelichalex Avatar answered Sep 22 '22 18:09

savelichalex