-
Notifications
You must be signed in to change notification settings - Fork 198
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]: Inconsistent behavior with Notifications.requestPermission(true)
when user prompted to change settings
#968
Comments
I can confirm this behaviour. I am not even able to subscribe anymore on Android, it always unsubscribes when calling |
When you say it unsubscribes you, do you mean that your subscription disappears from the dashboard or it gets flagged as "opted-out"? Is this Android 12 or 13 by the way? |
Have you called |
What login function? |
Yes I am just trying to see if I can match those symptoms (which seem even more buggy than the ones I reported) but my sequence of events is: But if I can get the same result as you then things are even worse than I reported here. |
As an aside, you should be aware of this issue too: #918 But that aside, when I do this
I do end up with this, but it takes quite a while to update correctly in the dashboard |
Hi @kpturner, thank you for reporting, I was able to reproduce the behavior with calling We will investigate a solution. |
Hi @louis123562, can you tell me more about your issue? When you prompt for permission but before a choice is made, the SDK may believe permission is not granted yet and send an update to the server causing the "Last Unsubscribed" date to be updated on the dashboard. (This is related to the issue reported by @kpturner that we will investigate.) Then when a choice is made on the permission prompt, a subsequent request is sent with that selection. Are you seeing it does not update in the dashboard after you give permission in the permission prompt? |
Just to be clear on the Android 12 situation: If you are prompted to change your settings, even if you allow them, |
I just tested on Android 14, it behaves the same as Android 13. When removing permission manually in Android settings, then going back into the app, call After accepting to receive notifications in the dialog, the Calling This also behaves the same, if the app is reinstalled and/or permissions where not granted yet. For my understanding, it is currently not possible to get any Android to subscribe. All my Android subscriptions either have the This is not great. With this, i am not able to reach any of my android users. |
@louis123562 it is worth noting that apparently |
I think @louis123562 is possibly experiencing the same issue as I describe here: #967 I can call I have no idea how to actually get it to regsiter that the user is opted in - or why it thinks the subscription is unsubscribed :( EDIT: I finally made it work by disallowing notifications on the device, then calling |
Any update on this @nan-li ? |
@kpturner this issue sounds similar to this one: Can you try the latest OneSignal SDK and test again? If you still see the same issue can you enable OneSignal VERBOSE logging and capture the logcat? Mainly looking for the REST API calls make to OneSignal. |
What happened?
If I call
Notifications.requestPermission(true)
on iOS or Android 13, and the call deems that it is necessary to prompt the user, two things happen:If 2) takes place, then the call to the function exits as soon as the user clicks the "Settings" button and returns
false
- so you do not actually know if the user allowed notifications in their settings or not.On Android 12, the function does not exit when the user clicks "Settings". In fact it does not return until the user has visited their settings, changed them and then return control to the app. At that point the function exits, but always returns
false
regardless of what the user did.So it seems impossible to know if the user has allowed notifications in their settings or not after calling
requestPermission(true)
With Android 13 and iOS you can at least have a listener on the
permissionChange
event which fires when the user changes the permission in the settings. The same does not work with Android 12. The event does fire (seemingly inconsistently) but provides completely the wrong value - alwaysfalse
even though permission has been granted.Steps to reproduce?
What did you expect to happen?
I expect Android 12 and 13 and iOS to behave consistently.
Ideally, the
requestPermission(true)
call would only return when the user has changed their settings, and will provide the correct value.Also, the
permissionChange
event should fire consistently in Android 12 and provide the correct value.OneSignal Cordova SDK version
5.0.4
Which platform(s) are affected?
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: