transistorsoft / flutter_background_geolocation

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

Will you support play-services-location v21? #932

Closed ozzy1873 closed 1 year ago

ozzy1873 commented 1 year ago

With the update to flutter_background_geolocation: ^4.8.7, at runtime, the app crashes with the following exception:

I/flutter (21036): _bgStart - [State enabled: false, isMoving: false, trackingMode: 1, desiredAccuracy: -1, distanceFilter: 5.0, odometer: 0.0, schedulerEnabled: false, foregroundService: true] I/flutter (21036): _onBgProviderChange - 3 I/TSLocationManager(21036): - Enable: false → true, trackingMode: 1 I/flutter (21036): _onBgEnabled - true D/ConnectivityManager(21036): requestNetwork; CallingUid : 10545, CallingPid : 21036 W/Settings(21036): Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value. I/flutter (21036): _bgStart: start complete - [State enabled: true, isMoving: false, trackingMode: 1, desiredAccuracy: -1, distanceFilter: 5.0, odometer: 0.0, schedulerEnabled: false, foregroundService: true] E/AndroidRuntime(21036): FATAL EXCEPTION: pool-8-thread-5 E/AndroidRuntime(21036): Process: com.osborntech.supercycle, PID: 21036 E/AndroidRuntime(21036): java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.FusedLocationProviderClient, but class was expected (declaration of 'com.google.android.gms.location.FusedLocationProviderClient' appears in /data/app/com.osborntech.supercycle-FK8M1yhjZGEFuAIi5zgDVw==/base.apk) E/AndroidRuntime(21036): at com.transistorsoft.locationmanager.location.SingleLocationRequest.startUpdatingLocation(Unknown Source:129) E/AndroidRuntime(21036): at com.transistorsoft.locationmanager.service.LocationRequestService.handleStartAction(Unknown Source:78) E/AndroidRuntime(21036): at com.transistorsoft.locationmanager.service.LocationRequestService.access$200(Unknown Source:0) E/AndroidRuntime(21036): at com.transistorsoft.locationmanager.service.LocationRequestService$a.run(Unknown Source:62) E/AndroidRuntime(21036): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) E/AndroidRuntime(21036): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) E/AndroidRuntime(21036): at java.lang.Thread.run(Thread.java:764) E/AndroidRuntime(21036): FATAL EXCEPTION: pool-8-thread-6 E/AndroidRuntime(21036): Process: com.osborntech.supercycle, PID: 21036 E/AndroidRuntime(21036): java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.FusedLocationProviderClient, but class was expected (declaration of 'com.google.android.gms.location.FusedLocationProviderClient' appears in /data/app/com.osborntech.supercycle-FK8M1yhjZGEFuAIi5zgDVw==/base.apk) E/AndroidRuntime(21036): at com.transistorsoft.locationmanager.location.SingleLocationRequest.startUpdatingLocation(Unknown Source:129) E/AndroidRuntime(21036): at com.transistorsoft.locationmanager.service.LocationRequestService.handleStartAction(Unknown Source:78) E/AndroidRuntime(21036): at com.transistorsoft.locationmanager.service.LocationRequestService.access$200(Unknown Source:0) E/AndroidRuntime(21036): at com.transistorsoft.locationmanager.service.LocationRequestService$a.run(Unknown Source:62) E/AndroidRuntime(21036): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) E/AndroidRuntime(21036): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) E/AndroidRuntime(21036): at java.lang.Thread.run(Thread.java:764) W/ActivityThread(21036): handleWindowVisibility: no activity for token android.os.BinderProxy@5848f18 I/Process (21036): Sending signal. PID: 21036 SIG: 9

I tried bumping googlePlayServicesLocationVersion to v21.0.1, but then I get a compile time message:

"background-geolocation requires a maximum googlePlayServicesLocationVersion of 20.0.0 due to breaking changes in v21. googlePlayServicesLocationVersion has been overridden to 20.0.0"

Pegging to v20.0.0 makes this plugin incompatible with another (flutter_map_location_marker: 5.1.0+1) I am using because it references the geolocator plugin (v9.0.2), which uses v21.0.1.

I reverted to flutter_map_location_marker v5.0.0+1, which references geolocator v9.0.1 and now my app runs.

There was a breaking change fixed in v21.0.1, as mentioned here: https://developers.google.com/android/guides/releases#october_13_2022.

Perhaps this fixes the breaking change you refer to in the compile-time message?

christocracy commented 1 year ago

https://github.com/transistorsoft/flutter_background_geolocation/blob/master/CHANGELOG.md#482---2022-10-26

ozzy1873 commented 1 year ago

Awesome, thanks!

christocracy commented 1 year ago

The CHANGELOG has a mistake. The next major release for the flutter version will be 4.9.0 with v21.