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

[question]: How to disable the onesignal notification permission dialog? #2172

Open
1 task done
SarathCodeRays opened this issue Aug 9, 2024 · 3 comments
Open
1 task done

Comments

@SarathCodeRays
Copy link

SarathCodeRays commented Aug 9, 2024

The following issue is being encountered in OneSignal SDK:

Alert Dialog After Permission Denial: The alert dialog shown in the attached screenshot appears on every app launch after the Notification Permission dialog is denied.

OneSignal.getNotifications().requestPermission(false, Continue.none());

The behavior of requestPermission remains the same regardless of whether the parameter is set to true or false.

Automatic Display of System Notification Permission Dialog: The OneSignal SDK automatically triggers the system's default Notification Permission dialog.

OneSignal.getDebug().setLogLevel(LogLevel.VERBOSE);
OneSignal.initWithContext(this,"xxxxxxxxxxxxxxxxxxxxx");
OneSignal.getNotifications().requestPermission(false, Continue.none());
OneSignal.getLocation().setShared(false);
OneSignal.setConsentRequired(true);

Despite using OneSignal SDK version 5.1.19 and even trying to downgrade the SDK, the issue persists.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@michael-winkler
Copy link

Why do you use the line:

OneSignal.getNotifications().requestPermission(false, Continue.none());

?

This method does ask for the permission (the name is really clear of the method)

@SarathCodeRays
Copy link
Author

Screenshot 2024-08-09 175003

Let me know which method shows this alert.

@jkasten2
Copy link
Member

jkasten2 commented Aug 29, 2024

@SarathCodeRays Only the follow should show OneSignal's "Notifications Not Available" as you noted above.

  1. requestPermission(true)
  2. optIn()
  3. A OneSignal in-app message prompting for notification permission when tapped on.

If you are still seeing an issue then do the follow:

  1. Can you reproduce the issue on the latest SDK? (5.1.20 at this time of writing)
  2. Can you remove other OneSignal code to get down to a MRE? (minimal reproducible example) and share this code?

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