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 214 forks source link

[Bug]: 5.0.4 Android SDK await addTagWithKey hangs #799

Closed johanlantz closed 9 months ago

johanlantz commented 12 months ago

What happened?

Migrating to 5.0.4 I am doing this init:

Future<bool> initOnesignal() async {
    OneSignal.initialize(myAppId);
    OneSignal.login(myExternalId);
    OneSignal.Location.setShared(false);
    OneSignal.User.addTagWithKey('aKey', 'aValue');
    return await OneSignal.Notifications.requestPermission(true);
}

However since most of these functions are async I added await on them but using: await OneSignal.User.addTagWithKey('aKey', 'aValue');

Causes Android to hang, took me quite some time to understand why the permission prompt did not show. In iOS it is fine.

There is a 202 response in the log for uploading the tag but does not work properly.

Steps to reproduce?

See code above

What did you expect to happen?

The sdk should not hang

OneSignal Android SDK version

5.0.4

Android version

13

Specific Android models

Pixel 7a with Android 14

Relevant log output

No response

Code of Conduct

jennantilla commented 11 months ago

Hello @johanlantz thanks for reaching out! Just to clarify, are you using the Android native SDK and theaddTag method? We do not have an addTagWithKey method. Thanks for the additional information!

johanlantz commented 11 months ago

This is using the Flutter SDK on an Android phone. I assumed it uses the native Android SDK under the hood but I guess the issue could also be in the plugin.

nan-li commented 11 months ago

Hey @johanlantz, Yes this await comes from the plugin itself when it calls into the native Android SDK. Thanks for reporting, we will investigate.

nan-li commented 9 months ago

Hi @johanlantz, thanks again for reporting this issue and your patience.

We have released the fix in Release 5.1.0.

Please update and reach out if you are still seeing issues. Thanks!