I'm trying to get the Android App Notification status with the check permission method here. Here's the code to check permission in Android
According the readme file, I did the following..
yarn add react-native-push-notificationimport PushNotification from 'react-native-push-notification';
async componentDidMount(){
PushNotification.checkPermission().then((response) => {
if (response && response.alert !== 0) {
console.log('hi4')
console.log(response)
return;
}
console.log('hi5')
console.log(response)
});
}
Am I doing anything wrong here to check the App Notification status in Android?
For iOS, I have this install.
yarn add @react-native-community/push-notification-ios
Hi @TommyLeong
As the Readme define that method, this is not supposed to be a promise. Actually only the iOS library allow this.
Regards
Hi @TommyLeong
As the Readme define that method, this is not supposed to be a promise. Actually only the iOS library allow this.
Regards
What does that suppose to mean? Is that a known bug for this lib?
This is not a "bug", this library use callbacks, not promises.
This is not a "bug", this library use callbacks, not promises.
Possible to provide sample code?
https://github.com/zo0r/react-native-push-notification#checking-notification-permissions
PushNotification.checkPermissions(callback: Function) Check permissions
callback will be invoked with a permissions object:
alert: boolean
badge: boolean
sound: boolean
PushNotification.checkPermissions(function(permissions) { console.log(permissions); });
Thanks @Dallas62, finally I get you now. 馃檹馃徎
Most helpful comment
https://github.com/zo0r/react-native-push-notification#checking-notification-permissions
PushNotification.checkPermissions(callback: Function)Check permissionscallbackwill be invoked with apermissionsobject:alert: booleanbadge: booleansound: boolean