Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: requestPermission with fallback true does not work correctly on Android 12 devices #951

Closed
2 of 3 tasks
kpturner opened this issue Dec 11, 2023 · 2 comments
Closed
2 of 3 tasks

Comments

@kpturner
Copy link

kpturner commented Dec 11, 2023

What happened?

If push notification permission has been denied, then when you use the requestPermission method passing true to fallback to the settings, the native settings prompt pops up. You can then give permission via the settings and return to the app. The requestPermission promise then resolves returning true (the user gave permission). However, on an Android 12 device (in this case a Nexus 6 running API 31) it always returns false.

To work around this, you can call hasPermission to get the correct value immediately after the requestPermission has resolved. However, if you call that method again for any other reason, it will always return false. Only by restarting the app will requestPermission return the correct value.

Steps to reproduce?

Use a Nexus 6 API 31 Android 12 emulator and test the requestPermission method with fallback enabled.

What did you expect to happen?

Should work as with later versions of Android.

OneSignal Cordova SDK version

Release 5.0.4

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jennantilla
Copy link
Contributor

Thank you for this report--we'll investigate further!

@jennantilla
Copy link
Contributor

Hello there--apologies that this issue has gone stale. We have made many improvements to our SDK since this was reported that could resolve this issue. Please update to our latest version and if you still have any problems, feel free to create a new issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants