react-native-onesignal
react-native-onesignal copied to clipboard
[Bug]: Incorrectly returning notification permission data until you close and open the app
What happened?
I want a notification permission when I enter the app. this permission is requested with react-native-permission.
import {requestNotifications} from 'react-native-permissions';
I am using requestNotifications.
But if I first get permission with OneSignal as below, there is no problem. when I enter the app, I can pull my data correctly.
await OneSignal.User.pushSubscription.optIn();
const notificationResult = await OneSignal.Notifications.getPermissionAsync()
When I request permission with react-native-permissions, permissionChange listener is not triggered.
OneSignal.Notifications.addEventListener(
'permissionChange',
(granted: boolean) => { // some code });
},
);
react-native-permissions : ^3.8.0 react-native-onesignal : ^5.1.0
If this is detected when local device permissions are changed, why is it not detected when another package changes it?
Thanks
Steps to reproduce?
1. install the app
2. request permission with react-native-permission
3. Log in to the app
4. check notification permission data with OneSignal
5. incorrect data until you exit the application
What did you expect to happen?
I would like OneSignal to know when notification permission is granted for the app. because my configurations are correct. if I close and open the app, the correct data comes through. but if I grant permission and never leave the app, the correct data never comes through. i added timeout and counter to try it out.
React Native OneSignal SDK version
5.1.0
Which platform(s) are affected?
- [ ] iOS
- [X] Android
Relevant log output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct