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]: fallback to settings prompt is shown when calling requestPermission(false) #1613

Open
2 of 3 tasks
Redn4s opened this issue Dec 11, 2023 · 3 comments
Open
2 of 3 tasks

Comments

@Redn4s
Copy link

Redn4s commented Dec 11, 2023

What happened?

When requesting the push permission after the user already declined push permissions, the "Open settings" prompt is still shown even when I pass false when calling requestPermission().

OneSignal.Notifications.requestPermission(false) // Still shows the "Open settings" alert

Steps to reproduce?

1. Install v5.0.4 of react-native-onesignal
2. Call `requestPermission(false)`
3. Decline the push permission
4. Call `requestPermission(false)` again
5. The "Open settings" prompt is shown

What did you expect to happen?

I expect the "Open settings" prompt not to show up when I call requestPermission(false) after the user already declined push permissions.

React Native OneSignal 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
@andrewdazs
Copy link

I was also getting this error and the problem was that I was calling requestPermission() twice inside the codebase. calling it only once solved the problem.

@BijuDey
Copy link

BijuDey commented Feb 19, 2024

I was also getting this error and the problem was that I was calling requestPermission() twice inside the codebase. calling it only once solved the problem.

I have called it just once still same issue

@unknwngera
Copy link

unknwngera commented Mar 15, 2024

OneSignal.Notifications.canRequestPermission().then(can => {
  if (can) OneSignal.Notifications.requestPermission(false)
})

solves this problem

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

4 participants