transistorsoft / flutter_background_geolocation

Sophisticated, battery-conscious background-geolocation & geofencing with motion-detection
https://www.transistorsoft.com/shop/products/flutter-background-geolocation
Other
638 stars 235 forks source link

Blank screen after resuming from headless mode on Android 12, 13 and 14 #1326

Open rairongf opened 1 month ago

rairongf commented 1 month ago

Your Environment

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at C:\Users*\AppData\Local\Android\sdk • Platform android-34, build-tools 34.0.0 • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231) • All Android licenses accepted.

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.5.4) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.5.33530.505 • Windows 10 SDK version 10.0.22000.0

[√] Android Studio (version 2022.3) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)

[√] VS Code (version 1.91.1) • VS Code at C:\Users\b2ml\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.92.0

[√] Connected device (2 available) • *** • Windows (desktop) • windows • windows-x64 • Microsoft Windows [versÆo 10.0.22631.3880]

[√] Network resources • All expected network resources are available.

• No issues found!

Expected Behavior

App successfully resumes UI while mantaining geolocation tracking from headless mode.

Actual Behavior

App becomes unusable due to a blank screen when opening right after starting headless mode.

Identified using Android Emulators with versions 12, 13 and 14.

Steps to Reproduce

Minimal reproducible code available at this Gist.

  1. bg.BackgroundGeolocation.start()
  2. terminate app
  3. wait for at least the first headless location event
  4. open app

Context

Resume location tracking from headless mode so the user can finish tracking by pressing a button that calls bg.BackgroundGeolocation.stop().

Debug logs

adb logcat *:S TSLocationManager:V flutter:V output available in attached file below.

Attached files

adb_logcat_output.txt

christocracy commented 1 month ago

I suggest you try to reproduce this with the /example app in this repo. I'm on vacation until July 26.

rairongf commented 1 month ago

I encountered the same problem when running the /example application.

kaciula commented 1 month ago

@rairongf How exactly are you running the example app? What changes did you make to the example app to reproduce the issue? Please give as much step-by-step details as possible.

rairongf commented 1 month ago

@kaciula I haven't changed anything in the code of the example app.

I just accessed the HelloWorldPage, enabled the permissions, started the plugin (.start()) and closed the application to activate the headless mode.

Then I opened the application again and an empty screen appeared in the same way.

christocracy commented 1 month ago

I will test this next week when I return from vacation.

rairongf commented 1 month ago

I was able to test the behavior on two physical devices with Android version 14 today. It was not possible to reproduce the problem on these devices.

This may indicate that the problem described only occurs in simulators, but further research would be valuable.

rairongf commented 3 weeks ago

Any news on this problem?

christocracy commented 3 weeks ago

I am unable to reproduce this issue on my test devices.