Open Chasty opened 4 months ago
If you want to reproduce it, try to run on a physical android phone, and also I've created the repository, so u can take a look there.
@nan-li Hello, could u able to reproduce this?
I've got similar issue on Android
App request notification permission(first time) through android native request permission modal and accept it, then OneSignal.Notifications.addEventListener("permissionChange") not detect permissionChange.
After app went to background and came back foreground, AppState.addEventListener('change') call getPermissionAsync and it response true. In same time, OneSignal.Notifications.addEventListener("permissionChange") finally detect permissionChange.
React Native version : 0.73 React Native OneSignal SDK version : 5.2.0
What happened?
At the latest sdk, the listener permissionChange is not giving the correct value in a specific scenario when you enable the permission check from phone settings only when tapping on
SETTINGS
when notifications not available.it first gives the value of true, that means the permission check is enabled, but after some milliseconds it returns a false value.
related code.
const hasPermission = await OneSignal.Notifications.getPermissionAsync();
And then, using the method above to get the permission value is giving all the time a false value until you background/foreground.
https://github.com/OneSignal/react-native-onesignal/assets/18494040/0a45a12c-e2ae-41b5-a100-e958f18b4290
Steps to reproduce?
What did you expect to happen?
React Native OneSignal SDK version
5.1.3
Which platform(s) are affected?
Relevant log output
Code of Conduct