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]: canRequestPermission always returns true on Android #966

Open
2 of 3 tasks
kpturner opened this issue Jan 26, 2024 · 1 comment
Open
2 of 3 tasks

[Bug]: canRequestPermission always returns true on Android #966

kpturner opened this issue Jan 26, 2024 · 1 comment

Comments

@kpturner
Copy link

kpturner commented Jan 26, 2024

What happened?

On iOS I can call canRequestPermission and it will return true if the device has not yet been prompted for notification permission. If the device has been previously prompted, it will return false. On an Android 13 device it always returns true even if the user has previously been prompted, rendering it useless. This means we have logic around this function that works on iOS and fails on Android.

Steps to reproduce?

Call `canRequestPermission` on a newly installed app - it returns `true`
Call `requestPermission(true)` and you will get the native prompt to allow permission
Call `canRequestPermission` again.  Instead of returning `false` it continues to return `true`

What did you expect to happen?

It should work as documented and as it does in iOS

OneSignal Cordova SDK version

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
@kpturner
Copy link
Author

Actually it seems to continue to return true UNLESS, when you respond to the prompt, you click Allow. Then the canRequestPermission will return false. So it is different behavior to iOS but possibly expected?

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

1 participant