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]: Android: requestPermission() doesn't resolve when permission is denied #926

Open
2 of 3 tasks
terreng opened this issue Sep 30, 2023 · 4 comments
Open
2 of 3 tasks

Comments

@terreng
Copy link

terreng commented Sep 30, 2023

What happened?

Unlike on iOS, requestPermission() doesn't resolve when the user denies the notification permission on Andriod (or if a prompt can't be shown).

On iOS, the method will resolve with either true or false.

On Android, the method only resolves if it's true.

Steps to reproduce?

Run the following:

window.plugins.OneSignal.Notifications.requestPermission(false).then(function (accepted) {
  console.log(accepted)
})

If you deny permission, observe that nothing is printed.

What did you expect to happen?

The method should always resolve with either true or false.

OneSignal Cordova SDK version

5.0.1

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

@terreng thank you for reporting! We'll work on incorporating this into a future release.

@terreng
Copy link
Author

terreng commented Oct 10, 2023

Thanks. This wasn't an issue before 5.x. It used to work. I hope that this can be corrected soon.

@mariusbolik
Copy link

I can confirm this Issue! I wondered why my app didn't launch and the splash screen didn't disappear. It's really important for me that the function resolves correctly, so I can call OneSignal.User.pushSubscription.optIn(); at the right time.

@mariusbolik
Copy link

Was this error fixed in v5.0.3 (#936)?

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

3 participants