OneSignal / react-native-onesignal

React Native Library for OneSignal Push Notifications Service
Other
1.57k stars 374 forks source link

[Bug]: Permission Not Granted (Android) #1679

Open johannessachse opened 5 months ago

johannessachse commented 5 months ago

What happened?

Since version 5.0.6 some Android devices (f.e. Pixel 7, Android 14) in our OneSignal dashboard have "Subscription Status: Permission Not Granted". On my SM-T510 (Android 11) everything works fine. On iOS everything works fine too.

When logging OneSignal.Notifications.hasPermission() or OneSignal.Notifications.getPermissionAsync() we always get true as excepted.

Versions: react-native: 0.72.7 react-native-onesignal: 5.0.5 (works) react-native-onesignal: 5.0.6 (does not work) react-native-onesignal: 5.1.0 (does not work)

Steps to reproduce?

1. Launch app
2. Grant notification permission
3. Check for subscription status in dashboard

What did you expect to happen?

I expect that we get "Subscription Status: Permission Granted"

React Native OneSignal SDK version

Release 5.1.0

Which platform(s) are affected?

Relevant log output

        // Logs of the device with granted permissions
        const canRequestPermission = await OneSignal.Notifications.canRequestPermission();
        console.log('canRequestPermission', canRequestPermission); // false

        const hasPermission = OneSignal.Notifications.hasPermission();
        console.log('hasPermission', hasPermission); // true

        const getPermissionAsync = await OneSignal.Notifications.getPermissionAsync();
        console.log('getPermissionAsync', getPermissionAsync); // true

        const requestPermission = await OneSignal.Notifications.requestPermission(true);
        console.log('requestPermission', requestPermission); // true

Code of Conduct

hjun555 commented 5 months ago

onesignal sdk version 5.1.1 and 5.1.2 have same problem. any solutions?

johannessachse commented 5 months ago

We are currently in contact with OneSignal support and waiting for the issue to be resolved.

hjun555 commented 5 months ago

@johannessachse
Do you use externalId? I removed all devices which have same external id and it become works. Hope this helps you.

johannessachse commented 5 months ago

@johannessachse Do you use externalId? I removed all devices which have same external id and it become works. Hope this helps you.

What do you mean with externId? We only have the Subscription ID and OneSignal ID. Did you remove the devices via the "Subscription Records" Dashboard?

BishalftSaikia commented 4 months ago

maybe related to android version, from 13 and above there is this issue going around :: https://github.com/OneSignal/OneSignal-Android-SDK/issues/1824#issuecomment-1914733585 add implementation "com.google.firebase:firebase-messaging:23.4.0" in app/build.gradle

humqn commented 4 months ago

Hello, same here, any update ?

johannessachse commented 4 months ago

@humqn I don't think so. We still use version 5.0.5 (works). Maybe there is a fix in the latest version. But we haven't tested it yet.

humqn commented 4 months ago

@johannessachse ok thank you, I have downgraded to 5.0.5 and it works as desired.

konangels commented 2 months ago

any further updates?? Im using react-native-onesignal v5.2.0 and am also having this issue with Android devices

johannessachse commented 1 month ago

@konangels We are still waiting for a fix.

konangels commented 1 month ago

@johannessachse appreciate the update. Thank you.