flutter_background_geolocation
flutter_background_geolocation copied to clipboard
Sometimes blank screen is appeared after launching app
Your Environment
-
Plugin version: 4.10.3
-
Platform: iOS
-
OS version: 16.1
-
Device manufacturer / model: Iphone 11
-
Flutter info (
flutter doctor
): -
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
- Create Config class
- Call await bg.BackgroundGeolocation.ready(iosGeofenceSettings.config) in initState of application.dart;
- Call await bg.BackgroundGeolocation.start(); in initState of application.dart;
- 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?
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?
I will try to send logs via email and let you know if this situation will happen again
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?
I really doubt this has anything to do with the plugin.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
@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.
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 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.
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.
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
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.
@christocracy Any thoughts on my latest comment and logs?
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.
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).