I want to check push notification permission for both ios and android. I want to see if user has switched off the push notification permission from his device settings. Is there any plugin or any code i can take reference from if needed to be coded in native.
You can check react-native-permissions npm. After integrating you can use it like:
componentDidMount() {
Permissions.check('notification').then(response => {
// Response is one of: 'authorized', 'denied', 'restricted', or 'undetermined'
this.setState({ photoPermission: response })
})
}
There is another library that can help (I have not used it).
There is also native implementation for as suggested here.
Official way https://github.com/react-native-community/react-native-permissions#checknotifications
import {requestNotifications} from 'react-native-permissions';
requestNotifications(['alert', 'sound']).then(({status, settings}) => {
// …
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With