OneSignal-Flutter-SDK icon indicating copy to clipboard operation
OneSignal-Flutter-SDK copied to clipboard

[Bug]: Android "Permission Not Granted" in OneSignal dashboard despite being shown as "Subscribed" in application

Open jaggerharness opened this issue 11 months ago • 1 comments

What happened?

In the latest version of the SDK, I am unable to properly Opt In to notifications only on Android, iOS is working without issue. After requestPermission and granting notification access, the application displays that optedIn == true, but the OneSignal dashboard shows permission status as "Permission Not Granted". At this time, I am unable to receive any notifications on the Android platform due to this issue.

Steps to reproduce?

1. Install 5.1.2 release of the package
2. Execute the following in main.dart to a physical Android device:

OneSignal.Debug.setLogLevel(OSLogLevel.verbose);
OneSignal.initialize("<YOUR APP ID HERE>");
OneSignal.Notifications.requestPermission(true);

3. Check OneSignal dashboard to see the device subscription displays Permission Not Granted

What did you expect to happen?

I expected that the user would show as subscribed in the dashboard and be able to to receive notifications.

OneSignal Flutter SDK version

Release 5.1.2

Which platform(s) are affected?

  • [ ] iOS
  • [X] Android

Relevant log output

I/OneSignal(13166): [Thread-21] FirebaseMessaging.getToken not found, attempting to use FirebaseInstanceId.getToken
I/OneSignal(13166): [Thread-21] Device registered, push token = 
D/OneSignal(13166): [Thread-21] OperationRepo.enqueue(operation: {"name":"update-subscription","appId":"<YOUR APP ID HERE>","onesignalId":"<ONE SIGNAL ID>","subscriptionId":"<SUB ID>","type":"PUSH","enabled":false,"address":"","status":"SUBSCRIBED"}, flush: false)
D/OneSignal(13166): [OpRepo] SubscriptionOperationExecutor(operations: [{"name":"update-subscription","appId":"<YOUR APP ID HERE>","onesignalId":"<ONE SIGNAL ID>","subscriptionId":"<SUB ID>","type":"PUSH","enabled":false,"address":"","status":"SUBSCRIBED","id":"<ID>"}])
D/OneSignal(13166): [DefaultDispatcher-worker-3] HttpClient: PATCH apps/<YOUR APP ID HERE>/subscriptions/<SUB ID> - {"subscription":{"type":"AndroidPush","token":"","enabled":false,"notification_types":1,"sdk":"050106","device_model":"SM-S146VL","device_os":"14","rooted":false,"net_type":0,"app_version":"10"}}
D/OneSignal(13166): [DefaultDispatcher-worker-3] HttpClient: PATCH apps/<YOUR APP ID HERE>/subscriptions/<SUB ID> - FAILED STATUS: 400
W/OneSignal(13166): [DefaultDispatcher-worker-3] HttpClient: PATCH RECEIVED JSON: {"errors":[{"code":"subscription-10","title":"Subscription can't change notification_types to positive integer while disabled"}]}
D/OneSignal(13166): [OpRepo] OperationRepo: execute response = FAIL_NORETRY
E/OneSignal(13166): Operation execution failed without retry: [{"name":"update-subscription","appId":"<YOUR APP ID HERE>","onesignalId":"<ONE SIGNAL ID>","subscriptionId":"<SUB ID>","type":"PUSH","enabled":false,"address":"","status":"SUBSCRIBED","id":"<ID>"}]

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

jaggerharness avatar Mar 21 '24 14:03 jaggerharness

I've found a temporary solution (https://github.com/OneSignal/OneSignal-Android-SDK/issues/1824#issuecomment-1914733585) by adding the following to the build.gradle:

implementation 'com.google.firebase:firebase-messaging:23.4.0'

jaggerharness avatar Mar 21 '24 14:03 jaggerharness

Same here! #900 Is there another solution than the implementation 'com.google.firebase:firebase-messaging:23.4.0'

We are not using this library, and we won't use it in our project.

arabnology avatar Jun 12 '24 22:06 arabnology

This bug will take forever to be fixed by the team! OneSignal, we trusted you at first, and now you left us at this risky time ?!

wasilni2022 avatar Jul 03 '24 14:07 wasilni2022

It's annoying that a question this simple takes so much time.

arda-copur avatar Aug 09 '24 14:08 arda-copur