flutter_map_location_marker icon indicating copy to clipboard operation
flutter_map_location_marker copied to clipboard

Granting only coarse location causes crash

Open Finni123 opened this issue 1 year ago • 4 comments

Describe the bug When I request location permission and only coarse location is granted, the app crashes. Nothing in my app uses location except for the location marker plugin, so it seems to be the cause.

To Reproduce Steps to reproduce the behavior:

  1. Create FlutterMap with a CurrentLocationLayer child
  2. Request Location permission (on Android)
  3. Grant Approximate / coarse location only
  4. App crashes

Expected behavior The map and this plugin should still work but show location with low precision, or no location.

Environment

  • Built on Windows 10 for Android 14
  • Flutter v3.22.1
  • flutter_map: ^7.0.1
  • flutter_map_location_marker: ^9.0.0
  • Overridden dependency because of this:
dependency_overrides:
 flutter_compass:
   git: https://github.com/helpisdev/flutter_compass.git

Error

E/AndroidRuntime(27264): FATAL EXCEPTION: main
E/AndroidRuntime(27264): Process: com.xyz.abc, PID: 27264
E/AndroidRuntime(27264): java.lang.SecurityException: Neither user 10575 nor current process has android.permission.ACCESS_FINE_LOCATION.
E/AndroidRuntime(27264): 	at android.os.Parcel.createExceptionOrNull(Parcel.java:3182)
E/AndroidRuntime(27264): 	at android.os.Parcel.createException(Parcel.java:3166)
E/AndroidRuntime(27264): 	at android.os.Parcel.readException(Parcel.java:3149)
E/AndroidRuntime(27264): 	at android.os.Parcel.readException(Parcel.java:3091)
E/AndroidRuntime(27264): 	at android.location.ILocationManager$Stub$Proxy.registerGnssNmeaCallback(ILocationManager.java:1622)
E/AndroidRuntime(27264): 	at android.location.LocationManager$GnssNmeaTransportManager.registerTransport(LocationManager.java:3109)
E/AndroidRuntime(27264): 	at android.location.LocationManager$GnssNmeaTransportManager.registerTransport(LocationManager.java:3099)
E/AndroidRuntime(27264): 	at com.android.internal.listeners.ListenerTransportManager.addListener(ListenerTransportManager.java:70)
E/AndroidRuntime(27264): 	at android.location.LocationManager.addNmeaListener(LocationManager.java:2611)
E/AndroidRuntime(27264): 	at android.location.LocationManager.addNmeaListener(LocationManager.java:2592)
E/AndroidRuntime(27264): 	at com.baseflow.geolocator.location.NmeaClient.start(NmeaClient.java:76)
E/AndroidRuntime(27264): 	at com.baseflow.geolocator.location.FusedLocationClient.requestPositionUpdates(FusedLocationClient.java:157)
E/AndroidRuntime(27264): 	at com.baseflow.geolocator.location.FusedLocationClient.lambda$startPositionUpdates$2$com-baseflow-geolocator-location-FusedLocationClient(FusedLocationClient.java:240)
E/AndroidRuntime(27264): 	at com.baseflow.geolocator.location.FusedLocationClient$$ExternalSyntheticLambda1.onSuccess(D8$$SyntheticClass:0)
E/AndroidRuntime(27264): 	at com.google.android.gms.tasks.zzm.run(com.google.android.gms:play-services-tasks@@18.1.0:1)
E/AndroidRuntime(27264): 	at android.os.Handler.handleCallback(Handler.java:959)
E/AndroidRuntime(27264): 	at android.os.Handler.dispatchMessage(Handler.java:100)
E/AndroidRuntime(27264): 	at android.os.Looper.loopOnce(Looper.java:232)
E/AndroidRuntime(27264): 	at android.os.Looper.loop(Looper.java:317)
E/AndroidRuntime(27264): 	at android.app.ActivityThread.main(ActivityThread.java:8501)
E/AndroidRuntime(27264): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(27264): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
E/AndroidRuntime(27264): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
E/AndroidRuntime(27264): Caused by: android.os.RemoteException: Remote stack trace:
E/AndroidRuntime(27264): 	at android.app.ContextImpl.enforce(ContextImpl.java:2333)
E/AndroidRuntime(27264): 	at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:2361)
E/AndroidRuntime(27264): 	at com.android.server.location.gnss.GnssManagerService.registerGnssNmeaCallback(GnssManagerService.java:191)
E/AndroidRuntime(27264): 	at com.android.server.location.LocationManagerService.registerGnssNmeaCallback(LocationManagerService.java:1087)
E/AndroidRuntime(27264): 	at android.location.ILocationManager$Stub.onTransact(ILocationManager.java:806)

Possible solution The error I get looks very similar to the error in this discussion, so I think maybe the solution from that thread should be applied to this plugin.

Finni123 avatar Jun 22 '24 17:06 Finni123

Wondering this is an issue in geolocator or not. Since the call stack show that it is from com.baseflow.geolocator.location.NmeaClient.start(NmeaClient.java:76).

tlserver avatar Jul 01 '24 13:07 tlserver

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Aug 01 '24 10:08 github-actions[bot]

Sorry, I cannot repoduce this issue. Does your problem still exist in current version?

tlserver avatar Aug 25 '24 13:08 tlserver

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Sep 25 '24 10:09 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Oct 03 '24 10:10 github-actions[bot]