Open softsan opened 1 month ago
Hello @softsan thanks for reaching out! Are you able to reproduce this on any devices you have? If so, capturing a debug log would be most helpful to see what's going on.
Thank you!
@jennantilla No, it doesn't reproduce on our dev environment. It mostly on Production user. I also observed that for some of the production user, it shows as "Permission denied" and "Not subscribed" error on OneSignal dashboard. Unfortunately we don't have any access of their device and it's hard for them as well to get the device logs. Btw, do you have any SDK method to capture OneSignal logs (release logs) / device logs into a flle? if so i can use that method to dump logs into file and upload it to my server.
@jennantilla Further on this, we have several other users who are seeing either "Permission not granted" or "Not subscribed" on OneSignal dashboard. We double checked that they logout from app, cleared their cache and data, uninstall and fresh install the app. But it still shows the the same on OneSignal dashboard.
@jennantilla Hello we have the same issue and we can reproduce it 100%.
Version: 5.1.14
How to reproduce?
Onesignal.login
to login user which already exists in onesignal console (that userId was previously logged in the app)OneSignal.getNotifications().requestPermission
and accept permissionBased on logs when you accept permission OperationRepo.enqueue(operation: {"name":"update-subscription
is enqueued and after that should be executed by SubscriptionOperationExecutor
and sent to console.
But problem is that if you manage to make step 3 (accepting permission) before login is executed via LoginUserOperationExecutor
than SubscriptionOperationExecutor
is not created and executed and subscription is in console shown as Permission Not Granted
and stuck in that state. (It seems that restarting the app or changing onesignal tags doesn't help. Only fix is to disable permission and enable it manually again).
When it works correctly?
Onesignal.login
and wait few seconds until LoginUserOperationExecutor
is executed and then accept permission, then it works correctly and SubscriptionOperationExecutor
is created and user is shown as subscribed in consoleSubscriptionOperationExecutor
is executed call Onesignal.login
, then it works correctly and user is shown as subscribed in consoleSo there seems to be small window if you accept permission after login before login is actually executed that causes this issue that subscription is shown as Permission not granted. We upgraded onesignal from 4.x to 5x and this causes huge issue for us so please take a look at it
Here is the full log you can examine based on steps to reproduce: https://www.dropbox.com/scl/fi/0zd5j9oszm0s67be6tivh/onesignal_issue.tft.rtf?rlkey=hxs6eeahdek9ykqzqddonqksv&dl=0
@socialError thanks for breaking down the issue and documenting exactly when the issue does and doesn't happen.
The root of the issue is when a LoginUserOperation
is being combined with a UpdateSubscriptionOperation
. LoginUserOperationExecutor
processes these together and makes a single REST API call as follows:
HttpClient: Request
Sent = POST
https://api.onesignal.com/apps/{{APP_ID}}/users - Body: {"identity":{"external_id":"SOME_EXISTING_ID"},"subscriptions":
[{"id":"11111111-2222-3333-444444444444","token":"FCM_PUSH_TOKEN","enabled":true,"notification_types":1}],"properties":
{"timezone_id":"Europe\/Bratislava","language":"en"},"refresh_device_metadata":true
}
The OneSignal REST API should be able to accept the subscription update, however as you noted there is a bug where if the externalId already exists the update on the subscription doesn't happen.
This is something the OneSignal backend is looking into, and we will update you here once it is fixed.
What happened?
For few of my users in production, can't get subscribed to Onesignal. It shows the record in subscription list but it shows as "Permission is not granted" I double / triple checked with the users and they all have given permission for Notification. They also did cache and data clear, logout, uninstall and fresh install several times but it doesn't make any difference. I am using the very latest version of OneSignal SDK. Here are some screenshots:
When i open that subscription, there is no "Externalid" and i am pretty sure I use that in my code:
Steps to reproduce?
What did you expect to happen?
It should subscribed to Onesignal and should receive push notifications.
OneSignal Android SDK version
5.1.13
Android version
13, 12, 11
Specific Android models
Relevant log output
No response
Code of Conduct