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]: In v5, the Subscription Status does not change to 'Subscribed'. #1947

Open
1 task done
kishibata opened this issue Dec 19, 2023 · 22 comments
Open
1 task done

Comments

@kishibata
Copy link

kishibata commented Dec 19, 2023

What happened?

スクリーンショット 2023-12-19 11 19 35

In v5, even if permission is granted on the OS notification permission dialog, the Subscription Status does not change to 'Subscribed.'

Steps to reproduce?

1. Turn off notification settings on the device.
2. Launch the app.
3. In the OS permission dialog for notifications, grant permission.

What did you expect to happen?

At the moment when permission is granted on the OS notification permission dialog, the Subscription Status changes to 'Subscribed.'

OneSignal Android SDK version

5.0.5

Android version

13

Specific Android models

Pixel 6a : Android14
Pixel 4 : Android13

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@emawby
Copy link
Contributor

emawby commented Dec 19, 2023

@kishibata Thank you for reaching out I have not been able to reproduce this. If possible could you share verbose logs when permission is granted so that we can try to debug this behavior?

@kishibata
Copy link
Author

@emawby
Thank you for your confirmation. I will share the logs at the following link.

https://docs.google.com/document/d/11Z1-UFyvUOGAmuZhiXKFPDdsFSc7TJKahRRue3-C9Q8/edit?usp=sharing

@kishibata
Copy link
Author

@emawby
any update on this issue?

@emawby
Copy link
Contributor

emawby commented Jan 12, 2024

Hello @kishibata thank you for the reminder. We believe we know the root cause of the issue and are working on a fix, but unfortunately it has not been resolved yet. To confirm our investigations have you noticed this happening if you don't call "Login" for the device? You may need to logout/reinstall to remove the cached user.

@kishibata
Copy link
Author

@emawby
Hello, and thank you for reaching out. I appreciate your update. I'm not entirely clear on the meaning of 'Login for the device'. Could you kindly provide more information or clarification about its significance in this context? Your assistance in understanding this matter is greatly appreciated. Thank you.

@gabriserra
Copy link

Hi everyone. I am using v5 and had the very same issue as @kishibata. As soon as the prompt button is clicked, the Android notification prompt is visualized, but the Subscription status remains as "not granted".

@cleawrence
Copy link

Hi everyone. I am using v5 and had the very same issue as @kishibata @gabriserra . the subscription remains as not granted

@kishibata
Copy link
Author

Hello @emawby
Could you please provide any updates on the status of this issue?

@kk-atom
Copy link

kk-atom commented Apr 2, 2024

Same here. I thought maybe 6 months after version 5.x release I can finally migrate, but nope. Back to version 4.x.
You should listen for android.permission.POST_NOTIFICATIONS permission and update status accordingly.

@marvin-hris
Copy link

owh common i got this issue too, doesnt work for android 14, any update from one signal?
i'm using flutter by the way

image

@sebastinto
Copy link

Experiencing the same issue after migration using version 5.1.7.

We ask for the notification permission without using the OneSignal SDK (i.e. without calling OneSignal.Notifications.requestPermission()). After the permission has been granted, OneSignal.Notifications.permission remains false. If OneSignal.Notifications.requestPermission() is called after the permission has been granted OneSignal.Notifications.permission is then set to true. Unfortunately, this is not reflected in the Subscription Status.

Calling OneSignal.Notifications.requestPermission() before the permission is granted and granting the permission via the system dialog also does not update the Subscription Status.

This happens after deleting data & cache or with a fresh install.

@marvin-hris
Copy link

try this one signal update issue for android or flutter

@sebastinto
Copy link

try this one signal update issue for android or flutter

Unfortunately this did not work for me. :'(

@cleawrence
Copy link

This is what i did to work it for me.
In build gradle
Kotlin version = 1.9.10
Upgrade your gradle version to 8.4
change your version to classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.14.0' in build gradle
onesignal version in build gradle app implementation 'com.onesignal:OneSignal:5.1.5'
dont forget to add firebase messaging i.e implementation 'com.google.firebase:firebase-messaging:23.4.1' (necessary for onesignal to work correctly).

@sebastinto
Copy link

classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.14.0'

FWIW, the gradle plugin seems to be deprecated

@agwidarsito
Copy link

Same issue here :(

@sebastinto
Copy link

sebastinto commented Apr 15, 2024

@jkasten2 FWIW, this is still happening on 5.1.8.

However, force closing and launching the app again seems to do the trick. Unfortunately I'm unsure whether this is a new behavior or existed prior to 5.1.8.

So what I'm seeing on my end is:

  1. Log in / identify user: user is found in Subscription Records in the OneSignal dashboard + External ID is correctly set + Subscription Status is Permission Not Granted (as expected since we haven't requested the permission yet)
  2. Grant permission via system dialog: Subscription Status is still Permission Not Granted
  3. Force close and relaunch: Subscription Status is now

@jkasten2
Copy link
Member

@sebastinto Thanks for the details, I have some follow up questions to narrow down the issue further.

  1. Grant permission via system dialog: Subscription Status is still Permission Not Granted

Are you prompting with OneSignal? If you are not, then your issue is most likely due to #1854.

  1. Log in / identify user: user is found in Subscription Records in the OneSignal dashboard + External ID is correctly set + Subscription Status is Permission Not Granted (as expected since we haven't requested the permission yet)

If you don't call login do you still see the same issue? Another thing to try is keep calling login(), but wait 30 or seconds then prompt and accept the prompt.

  • This will help determine if the issue is related to login() or an race condition.

Lastly, can you share a logcat with OneSignal VERBOSE logging of reproducing the issue?

@sebastinto
Copy link

Are you prompting with OneSignal? If you are not, then your issue is most likely due to #1854.

We are not so you're right it's likely related to #1854.

If you don't call login do you still see the same issue?

Yes.

can you share a logcat with OneSignal VERBOSE logging of reproducing the issue?

Is there a non public way I can share this with you? Email maybe?

@jkasten2
Copy link
Member

Is there a non public way I can share this with you? Email maybe?

If your issue was #1854 then you can omit sending us the log, as that is a know issue. If you are still seeing this problem afterwards then you can send the logcat to support@onesignal.com, and sharing with them a link to this thread.

@EinfachHans
Copy link

EinfachHans commented May 10, 2024

@jkasten2 i just came across the same problem. Removing the login seems to solve it, but oc is not really a solution.

Any fix for this planned already?

Edit: I request the permission via OneSignal

@EinfachHans
Copy link

Here are some logs, hope this helps. I removed my package name and replaced the appId with my-app-id.

See logs
2024-05-10 15:35:43.649 14574-14716 OneSignal               com.some.package            D  [CapacitorPlugins] login(externalId: 4a5c31c0-cd0a-4917-9a16-b8c301129250, jwtBearerToken: null)
2024-05-10 15:35:43.650 14574-14716 OneSignal               com.some.package            D  [CapacitorPlugins] createAndSwitchToNewUser()
2024-05-10 15:35:43.651 14574-14716 OneSignal               com.some.package            D  [CapacitorPlugins] Retrieving service interface com.onesignal.core.internal.application.IApplicationService
2024-05-10 15:35:43.652 14574-14716 OneSignal               com.some.package            D  [CapacitorPlugins] Already instantiated: com.onesignal.core.internal.application.impl.ApplicationService@d95ea1a
2024-05-10 15:35:43.653 14574-14716 OneSignal               com.some.package            D  [CapacitorPlugins] Retrieving service interface com.onesignal.core.internal.application.IApplicationService
2024-05-10 15:35:43.653 14574-14716 OneSignal               com.some.package            D  [CapacitorPlugins] Already instantiated: com.onesignal.core.internal.application.impl.ApplicationService@d95ea1a
2024-05-10 15:35:43.661 14574-14716 OneSignal               com.some.package            D  [CapacitorPlugins] OperationRepo.enqueue(operation: {"name":"transfer-subscription","appId":"my-app-id","subscriptionId":"959fe49a-3b0e-4d88-98cd-2e9248f7a25b","onesignalId":"local-8f0eac98-43de-4fcd-a185-7192bbb16010"}, flush: false)
2024-05-10 15:35:43.673 14574-15435 OneSignal               com.some.package            D  [Thread-22] OperationRepo.enqueueAndWait(operation: {"name":"login-user","appId":"my-app-id","onesignalId":"local-8f0eac98-43de-4fcd-a185-7192bbb16010","externalId":"4a5c31c0-cd0a-4917-9a16-b8c301129250","existingOnesignalId":"71fecfee-f6cf-46f1-85a4-9a45942fe433"}, force: false)
2024-05-10 15:35:43.773 14574-14716 OneSignal               com.some.package            D  [CapacitorPlugins] NotificationsManager.requestPermission()
2024-05-10 15:35:43.789 14574-14574 OneSignal               com.some.package            D  [main] ApplicationService.onActivityPaused(1,APP_OPEN): com.some.package.MainActivity@a2e5127
2024-05-10 15:35:43.809 14574-14574 OneSignal               com.some.package            D  [main] ApplicationService.onActivityCreated(1,APP_OPEN): com.onesignal.core.activities.PermissionsActivity@52ac185
2024-05-10 15:35:43.809 14574-14574 OneSignal               com.some.package            D  [main] initWithContext(context: com.onesignal.core.activities.PermissionsActivity@52ac185, appId: null)
2024-05-10 15:35:43.809 14574-14574 OneSignal               com.some.package            D  [main] initWithContext: SDK already initialized
2024-05-10 15:35:43.809 14574-14574 OneSignal               com.some.package            D  [main] Retrieving service class com.onesignal.core.internal.permissions.impl.RequestPermissionService
2024-05-10 15:35:43.809 14574-14574 OneSignal               com.some.package            D  [main] Already instantiated: com.onesignal.core.internal.permissions.impl.RequestPermissionService@2164258
2024-05-10 15:35:43.810 14574-14574 OneSignal               com.some.package            D  [main] Retrieving service interface com.onesignal.core.internal.preferences.IPreferencesService
2024-05-10 15:35:43.810 14574-14574 OneSignal               com.some.package            D  [main] Already instantiated: com.onesignal.core.internal.preferences.impl.PreferencesService@44c94b
2024-05-10 15:35:43.825 14574-14574 OneSignal               com.some.package            D  [main] ApplicationService.onActivityStarted(1,APP_OPEN): com.onesignal.core.activities.PermissionsActivity@52ac185
2024-05-10 15:35:43.825 14574-14574 OneSignal               com.some.package            D  [main] ApplicationService: current activity=com.onesignal.core.activities.PermissionsActivity@52ac185
2024-05-10 15:35:43.828 14574-14574 OneSignal               com.some.package            D  [main] ApplicationService.onActivityResumed(2,APP_OPEN): com.onesignal.core.activities.PermissionsActivity@52ac185
2024-05-10 15:35:43.851 14574-14574 OneSignal               com.some.package            D  [main] ApplicationService.onActivityPaused(2,APP_OPEN): com.onesignal.core.activities.PermissionsActivity@52ac185
2024-05-10 15:35:44.608 14574-14574 OneSignal               com.some.package            D  [main] ApplicationService.onActivityResumed(2,APP_OPEN): com.some.package.MainActivity@a2e5127
2024-05-10 15:35:44.608 14574-14574 OneSignal               com.some.package            D  [main] ApplicationService: current activity=com.some.package.MainActivity@a2e5127
2024-05-10 15:35:44.639 14574-14574 OneSignal               com.some.package            D  [main] ApplicationService.onActivityStopped(2,APP_OPEN): com.onesignal.core.activities.PermissionsActivity@52ac185
2024-05-10 15:35:44.643 14574-14574 OneSignal               com.some.package            D  [main] ApplicationService.onActivityDestroyed(1,APP_OPEN): com.onesignal.core.activities.PermissionsActivity@52ac185
2024-05-10 15:35:45.091 14574-14574 OneSignal               com.some.package            D  [main] OperationRepo.enqueue(operation: {"name":"update-subscription","appId":"my-app-id","onesignalId":"local-8f0eac98-43de-4fcd-a185-7192bbb16010","subscriptionId":"959fe49a-3b0e-4d88-98cd-2e9248f7a25b","type":"PUSH","enabled":true,"address":"d71lwH_fQT6AshOIiXrmd4:APA91bHp70n5zVrEn-Q066hTEWEmsp7U0XY-BJ6Vu77BV59zuqJUc5UlT1fCXxPe8TNiu-rjG5GGd40pG5Epv1XECO9KZqSpXwQJZd6SwRRPZKiNAbw0K4EMbnei8dpqDf3xdx-UiodQ","status":"SUBSCRIBED"}, flush: false)
2024-05-10 15:35:50.119 14574-14807 OneSignal               com.some.package            D  [OpRepo] processQueueForever:ops:
                                                                                                    [bucket:1, retries:0, operation:{"name":"login-user","appId":"my-app-id","onesignalId":"local-8f0eac98-43de-4fcd-a185-7192bbb16010","externalId":"4a5c31c0-cd0a-4917-9a16-b8c301129250","existingOnesignalId":"71fecfee-f6cf-46f1-85a4-9a45942fe433","id":"23b3cee1-6e26-4e06-b07a-52142d1101e0"}
                                                                                                    , bucket:1, retries:0, operation:{"name":"transfer-subscription","appId":"my-app-id","subscriptionId":"959fe49a-3b0e-4d88-98cd-2e9248f7a25b","onesignalId":"local-8f0eac98-43de-4fcd-a185-7192bbb16010","id":"fe66f64e-05e3-4032-9202-da75433b26d4"}
                                                                                                    , bucket:1, retries:0, operation:{"name":"update-subscription","appId":"my-app-id","onesignalId":"local-8f0eac98-43de-4fcd-a185-7192bbb16010","subscriptionId":"959fe49a-3b0e-4d88-98cd-2e9248f7a25b","type":"PUSH","enabled":true,"address":"d71lwH_fQT6AshOIiXrmd4:APA91bHp70n5zVrEn-Q066hTEWEmsp7U0XY-BJ6Vu77BV59zuqJUc5UlT1fCXxPe8TNiu-rjG5GGd40pG5Epv1XECO9KZqSpXwQJZd6SwRRPZKiNAbw0K4EMbnei8dpqDf3xdx-UiodQ","status":"SUBSCRIBED","id":"f99ab24f-962e-4701-89e3-1c2d13c82589"}
                                                                                                    ]
2024-05-10 15:35:50.134 14574-14807 OneSignal               com.some.package            D  [OpRepo] LoginUserOperationExecutor(operation: [{"name":"login-user","appId":"my-app-id","onesignalId":"local-8f0eac98-43de-4fcd-a185-7192bbb16010","externalId":"4a5c31c0-cd0a-4917-9a16-b8c301129250","existingOnesignalId":"71fecfee-f6cf-46f1-85a4-9a45942fe433","id":"23b3cee1-6e26-4e06-b07a-52142d1101e0"}, {"name":"transfer-subscription","appId":"my-app-id","subscriptionId":"959fe49a-3b0e-4d88-98cd-2e9248f7a25b","onesignalId":"local-8f0eac98-43de-4fcd-a185-7192bbb16010","id":"fe66f64e-05e3-4032-9202-da75433b26d4"}, {"name":"update-subscription","appId":"my-app-id","onesignalId":"local-8f0eac98-43de-4fcd-a185-7192bbb16010","subscriptionId":"959fe49a-3b0e-4d88-98cd-2e9248f7a25b","type":"PUSH","enabled":true,"address":"d71lwH_fQT6AshOIiXrmd4:APA91bHp70n5zVrEn-Q066hTEWEmsp7U0XY-BJ6Vu77BV59zuqJUc5UlT1fCXxPe8TNiu-rjG5GGd40pG5Epv1XECO9KZqSpXwQJZd6SwRRPZKiNAbw0K4EMbnei8dpqDf3xdx-UiodQ","status":"SUBSCRIBED","id":"f99ab24f-962e-4701-89e3-1c2d13c82589"}])
2024-05-10 15:35:50.141 14574-14807 OneSignal               com.some.package            D  [OpRepo] IdentityOperationExecutor(operations: [{"name":"set-alias","appId":"my-app-id","onesignalId":"71fecfee-f6cf-46f1-85a4-9a45942fe433","label":"external_id","value":"4a5c31c0-cd0a-4917-9a16-b8c301129250"}])
2024-05-10 15:35:50.153 14574-14803 OneSignal               com.some.package            D  [DefaultDispatcher-worker-1] HttpClient: PATCH apps/my-app-id/users/by/onesignal_id/71fecfee-f6cf-46f1-85a4-9a45942fe433/identity - {"identity":{"external_id":"4a5c31c0-cd0a-4917-9a16-b8c301129250"}}
2024-05-10 15:35:50.370 14574-14803 OneSignal               com.some.package            D  [DefaultDispatcher-worker-1] HttpClient: PATCH apps/my-app-id/users/by/onesignal_id/71fecfee-f6cf-46f1-85a4-9a45942fe433/identity - FAILED STATUS: 409
2024-05-10 15:35:50.388 14574-14803 OneSignal               com.some.package            W  [DefaultDispatcher-worker-1] HttpClient: PATCH RECEIVED JSON: {"errors":[{"code":"user-2","title":"One or more Aliases claimed by another User","meta":{"external_id":"4a5c31c0-cd0a-4917-9a16-b8c301129250"}}]}
2024-05-10 15:35:50.396 14574-14807 OneSignal               com.some.package            D  [OpRepo] LoginUserOperationExecutor now handling 409 response with "code": "user-2" by switching to user with "external_id": "4a5c31c0-cd0a-4917-9a16-b8c301129250"
2024-05-10 15:35:50.410 14574-14803 OneSignal               com.some.package            D  [DefaultDispatcher-worker-1] HttpClient: POST apps/my-app-id/users - {"identity":{"external_id":"4a5c31c0-cd0a-4917-9a16-b8c301129250"},"subscriptions":[{"id":"959fe49a-3b0e-4d88-98cd-2e9248f7a25b","token":"d71lwH_fQT6AshOIiXrmd4:APA91bHp70n5zVrEn-Q066hTEWEmsp7U0XY-BJ6Vu77BV59zuqJUc5UlT1fCXxPe8TNiu-rjG5GGd40pG5Epv1XECO9KZqSpXwQJZd6SwRRPZKiNAbw0K4EMbnei8dpqDf3xdx-UiodQ","enabled":true,"notification_types":1}],"properties":{"timezone_id":"Europe\/Berlin","language":"de"},"refresh_device_metadata":true}
2024-05-10 15:35:50.723 14574-14803 OneSignal               com.some.package            D  [DefaultDispatcher-worker-1] HttpClient: POST apps/my-app-id/users - STATUS: 202 JSON: {"properties":{"tags":{"is_pro":"0"},"language":"de","timezone_id":"Europe/Berlin","country":"DE","first_active":1715347520,"last_active":1715348150},"identity":{"external_id":"4a5c31c0-cd0a-4917-9a16-b8c301129250","onesignal_id":"ec79e8f5-fd3d-40ae-9571-90a00c367ba3"},"subscriptions":[{"id":"959fe49a-3b0e-4d88-98cd-2e9248f7a25b","app_id":"my-app-id","type":"AndroidPush","token":"d71lwH_fQT6AshOIiXrmd4:APA91bHp70n5zVrEn-Q066hTEWEmsp7U0XY-BJ6Vu77BV59zuqJUc5UlT1fCXxPe8TNiu-rjG5GGd40pG5Epv1XECO9KZqSpXwQJZd6SwRRPZKiNAbw0K4EMbnei8dpqDf3xdx-UiodQ"}]}
2024-05-10 15:35:50.739 14574-14807 OneSignal               com.some.package            D  [OpRepo] OperationRepo: execute response = SUCCESS
2024-05-10 15:35:50.778 14574-14807 OneSignal               com.some.package            D  [OpRepo] retryAfterSeconds: null
2024-05-10 15:35:50.981 14574-14807 OneSignal               com.some.package            D  [OpRepo] processQueueForever:ops:
                                                                                                    null
2024-05-10 15:35:55.783 14574-14807 OneSignal               com.some.package            D  [OpRepo] processQueueForever:ops:
                                                                                                    [bucket:0, retries:0, operation:{"name":"refresh-user","appId":"my-app-id","onesignalId":"ec79e8f5-fd3d-40ae-9571-90a00c367ba3","id":"b603f563-af43-45d9-91ad-2430058de526"}
                                                                                                    ]
2024-05-10 15:35:55.785 14574-14807 OneSignal               com.some.package            D  [OpRepo] RefreshUserOperationExecutor(operation: [{"name":"refresh-user","appId":"my-app-id","onesignalId":"ec79e8f5-fd3d-40ae-9571-90a00c367ba3","id":"b603f563-af43-45d9-91ad-2430058de526"}])
2024-05-10 15:35:55.789 14574-14803 OneSignal               com.some.package            D  [DefaultDispatcher-worker-1] HttpClient: GET apps/my-app-id/users/by/onesignal_id/ec79e8f5-fd3d-40ae-9571-90a00c367ba3
2024-05-10 15:35:56.027 14574-14803 OneSignal               com.some.package            D  [DefaultDispatcher-worker-1] HttpClient: GET apps/my-app-id/users/by/onesignal_id/ec79e8f5-fd3d-40ae-9571-90a00c367ba3 - STATUS: 200 JSON: {"properties":{"tags":{"is_pro":"0"},"language":"de","timezone_id":"Europe/Berlin","country":"DE","first_active":1715347520,"last_active":1715348150},"identity":{"external_id":"4a5c31c0-cd0a-4917-9a16-b8c301129250","onesignal_id":"ec79e8f5-fd3d-40ae-9571-90a00c367ba3"},"subscriptions":[{"id":"959fe49a-3b0e-4d88-98cd-2e9248f7a25b","app_id":"my-app-id","type":"AndroidPush","token":"d71lwH_fQT6AshOIiXrmd4:APA91bHp70n5zVrEn-Q066hTEWEmsp7U0XY-BJ6Vu77BV59zuqJUc5UlT1fCXxPe8TNiu-rjG5GGd40pG5Epv1XECO9KZqSpXwQJZd6SwRRPZKiNAbw0K4EMbnei8dpqDf3xdx-UiodQ","enabled":false,"notification_types":0,"session_time":0,"session_count":1,"sdk":"050110","device_model":"Pixel 7a","device_os":"14","rooted":false,"test_type":0,"app_version":"31","net_type":0,"carrier":"","web_auth":"","web_p256":""}]}
2024-05-10 15:35:56.055 14574-14807 OneSignal               com.some.package            D  [OpRepo] OperationRepo: execute response = SUCCESS
2024-05-10 15:35:56.056 14574-14807 OneSignal               com.some.package            D  [OpRepo] retryAfterSeconds: null
2024-05-10 15:35:56.260 14574-14807 OneSignal               com.some.package            D  [OpRepo] processQueueForever:ops:
                                                                                                    null

User logs in into the app, i call the sdk's login method. After that i request the permission. As mentioned above the removal of login works. I use the latest cordova version. Same works on ios.

Let me know if you need additional information.

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

10 participants