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

[Bug]:On Android lifecycleInit() never complete a Future.

Open victorvhpg opened this issue 1 year ago • 1 comments

What happened?

In Android all lifecycleInit method don't complete the Future, java needs a result like iOS do.

iOS https://github.com/OneSignal/OneSignal-Flutter-SDK/blob/7e921f0b0d34745963464b51979c89466fb2b715/ios/Classes/OSFlutterNotifications.m#L106

- (void)lifecycleInit:(FlutterMethodCall *)call withResult:(FlutterResult)result {
    [OneSignal.Notifications addForegroundLifecycleListener:self];
    [OneSignal.Notifications addPermissionObserver:self];
    result(nil);
}

Android https://github.com/OneSignal/OneSignal-Flutter-SDK/blob/7e921f0b0d34745963464b51979c89466fb2b715/android/src/main/java/com/onesignal/flutter/OneSignalNotifications.java#L195

    private void lifecycleInit() {
        OneSignal.getNotifications().addForegroundLifecycleListener(this);
        OneSignal.getNotifications().addPermissionObserver(this);
    }

Steps to reproduce?

this Future never completes on Android      
 await OneSignal.Notifications.lifecycleInit();

What did you expect to happen?

complete the Future

OneSignal Flutter SDK version

Release 5.2.3

Which platform(s) are affected?

  • [ ] iOS
  • [X] Android

Relevant log output

No response

Code of Conduct

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

victorvhpg avatar Aug 20 '24 11:08 victorvhpg

@victorvhpg thanks for reaching out! We'll look into this.

jennantilla avatar Aug 20 '24 19:08 jennantilla