OneSignal / OneSignal-Flutter-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your flutter app with OneSignal
https://www.onesignal.com
Other
625 stars 215 forks source link

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

Closed jaggerharness closed 3 months ago

jaggerharness commented 8 months ago

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?

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

jaggerharness commented 8 months ago

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'

arabnology commented 5 months ago

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.

wasilni2022 commented 4 months ago

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 ?!

arda-copur commented 3 months ago

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