flutter_background_geolocation icon indicating copy to clipboard operation
flutter_background_geolocation copied to clipboard

Sometimes blank screen is appeared after launching app

Open vovaklh opened this issue 1 year ago • 5 comments

Your Environment

  • Plugin version: 4.10.3

  • Platform: iOS

  • OS version: 16.1

  • Device manufacturer / model: Iphone 11

  • Flutter info (flutter doctor): image

  • Plugin config:

final config = bg.Config(
    reset: true,
    locationAuthorizationRequest: "Always",
    disableLocationAuthorizationAlert: true,
    desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH,
    stopOnTerminate: false,
    startOnBoot: true,
    autoSync: false,
    debug: getFlavorDependentValue<bool>(true, false),
    logLevel: getFlavorDependentValue(bg.Config.LOG_LEVEL_VERBOSE, bg.Config.LOG_LEVEL_OFF),
    geofenceModeHighAccuracy: true,
    geofenceInitialTriggerEntry: true,
    geofenceProximityRadius: 1000,
    showsBackgroundLocationIndicator: true,
    enableHeadless: true,
  );

Expected Behavior

Sometimes blank screen is appeared after app was collapsed and opened again.

Actual Behavior

The blank screen is not appeared

Steps to Reproduce

  1. Create Config class
  2. Call await bg.BackgroundGeolocation.ready(iosGeofenceSettings.config) in initState of application.dart;
  3. Call await bg.BackgroundGeolocation.start(); in initState of application.dart;
  4. The blank screen is appeared

So, I use await keyword for both callbacks. My splash screen has gif animation. Can callbacks interrupt the Event Loop? Also should I use bg.BackgroundGeolocation.stop() in app startup?

vovaklh avatar Apr 24 '23 12:04 vovaklh

Are you observing the plug-in logs? See wiki “Debugging”.

Also should I use bg.BackgroundGeolocation.stop() in app startup?

Why would you do that?

christocracy avatar Apr 24 '23 12:04 christocracy

I will try to send logs via email and let you know if this situation will happen again

vovaklh avatar Apr 24 '23 13:04 vovaklh

This is also happening to me. It only happens on iOS in release mode. Closing the application and reopening results in a blank white screen. You have to close and reopen a couple of times before things work properly. Not sure how to troubleshoot because it does not happen in debug mode. Wondering if you have resolved this for your application? Anything else I can do for an iOS release build to debug the issue?

gmparker2000 avatar Jul 10 '23 16:07 gmparker2000

I really doubt this has anything to do with the plugin.

christocracy avatar Jul 10 '23 16:07 christocracy

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar May 05 '24 01:05 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar May 19 '24 01:05 github-actions[bot]

@christocracy I also have several users reporting the blank screeen issue. I have reports for iPhone 15 Pro, iPhone 12 Pro and iPhone 12 mini, all using iOS 17.5.1.

After a lot of debugging, I finally asked them to use the app with and without the background geolocation plugin enabled and it only happens when the plugin is in use. So the issue is indeed connected with the plugin.

I haven't yet managed to reproduce the issue myself but I'm still trying.

kaciula avatar Jul 12 '24 11:07 kaciula

It’s not caused by the plug-in, but what you do in the event-listeners you’re subscribed to. The event-listeners you subscribe to are your code.

christocracy avatar Jul 12 '24 12:07 christocracy

@christocracy Your Github answers are always disappointing. Everyone else is to blame but the plugin. You constantly dismiss any developer report. And all this for a PAID product.

Coming back to the issue at hand, my app does not do anything in the event listeners apart from a simple logging call.

Screenshot 2024-07-12 at 16 09 14

kaciula avatar Jul 12 '24 13:07 kaciula

not always. After 10 years, I know what’s my responsibility. I know when things are chronic.

Create for me a simple hello-world app which reproduces your issue, share it with me in a public repo.

christocracy avatar Jul 12 '24 13:07 christocracy

I managed to reproduce the issue on my iPhone 11 with latest ios 17.5.1.

I've run my app, enabled the plugin and then paused the app. I resumed the app once more and confirmed that it rendered correctly. Then I paused again and left it alone for a day. The next day, when opening the app, it shows a blank screen. Tapping constantly on the screen does no do anything but it does not look like the app is unresponsive. It just doesn't show the UI. After forcefully terminating the app, I could open the app just fine. And then I retrieved the app logs and the plugin logs.

From the app logs it looks like the app started fine, did the initial logic and rendered the UI. Just that the UI did not actually appear on the phone's screen. I'm wondering if somehow the app is running in a different isolate or process because of how the plugin runs in the background. I'm shooting in the dark here but I've never encountered this behavior with any Flutter apps I've developed.

I am attaching the plugin logs below. The only thing that stands out for me is -[TSHttpService finish:error:] Success: 1

background-geolocation.log

Are the callbacks always run in the main isolate of the main process of the app? I'm wondering if maybe sometimes they are triggered in a different isolate/process.

kaciula avatar Jul 25 '24 09:07 kaciula

@christocracy Any thoughts on my latest comment and logs?

kaciula avatar Aug 09 '24 12:08 kaciula

The only thing that stands out for me is -[TSHttpService finish:error:] Success: 1

What is it about this line stands out to you? It's the the plugin's HTTPService finishing its work with a result of "Success".

Are the callbacks always run in the main isolate of the main process of the app? I'm wondering if maybe sometimes they are triggered in a different isolate/process.

Callbacks are always executed on the Main thread. The iOS flutter plugin code (which you can view here) does not deal with multiple isolates.

I've run my app, enabled the plugin and then paused the app. I resumed the app once more and confirmed that it rendered correctly. Then I paused again and left it alone for a day. The next day, when opening the app, it shows a blank screen.

I cannot reproduce this with the /example app from this repo, which I've been running daily for years.

christocracy avatar Aug 09 '24 16:08 christocracy

I suggest you check your code and ensure the .ready(config) is being called each and every time your app launches, no matter what (even if automatically launched by the OS in the background).

christocracy avatar Aug 09 '24 16:08 christocracy