mapbox-navigation-android icon indicating copy to clipboard operation
mapbox-navigation-android copied to clipboard

Crash when MapboxTripService is starting

Open empratysg opened this issue 1 year ago • 1 comments

I've been getting a lot of crash reports from Firebase lately.

Here's the info I got from Firebase

It seems to be a bug related to starting Mapbox Service from the Background while running with Android Auto

I can't reproduce it yet I'll update if I find a way to figure it out

Android API: 34 Mapbox Navigation SDK version: 2.20.2

Stack Traces

Fatal Exception: java.lang.RuntimeException: Unable to start service com.mapbox.navigation.core.trip.service.NavigationNotificationService@81f8e73 with Intent { cmp=com.sg.ncs.breeze/com.mapbox.navigation.core.trip.service.NavigationNotificationService }: java.lang.SecurityException: Starting FGS with type location callerApp=ProcessRecord{feee410 7408:com.sg.ncs.breeze/u0a346} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_LOCATION] any of the permissions allOf=false [android.permission.ACCESS_COARSE_LOCATION, android.permission.ACCESS_FINE_LOCATION] and the app must be in the eligible state/exemptions to access the foreground only permission at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5137) at android.app.ActivityThread.-$$Nest$mhandleServiceArgs() at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2474) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:222) at android.os.Looper.loop(Looper.java:314) at android.app.ActivityThread.main(ActivityThread.java:8779) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:569) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1090)

Caused by java.lang.SecurityException: Starting FGS with type location callerApp=ProcessRecord{feee410 7408:com.sg.ncs.breeze/u0a346} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_LOCATION] any of the permissions allOf=false [android.permission.ACCESS_COARSE_LOCATION, android.permission.ACCESS_FINE_LOCATION] and the app must be in the eligible state/exemptions to access the foreground only permission at android.os.Parcel.createExceptionOrNull(Parcel.java:3057) at android.os.Parcel.createException(Parcel.java:3041) at android.os.Parcel.readException(Parcel.java:3024) at android.os.Parcel.readException(Parcel.java:2966) at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7282) at android.app.Service.startForeground(Service.java:775) at com.mapbox.navigation.core.trip.service.NavigationNotificationService.notificationDataObserver$lambda-0(NavigationNotificationService.kt:23) at com.mapbox.navigation.core.trip.service.MapboxTripService$Companion.registerOneTimeNotificationDataObserver$libnavigation_core_release(MapboxTripService.kt:45) at com.mapbox.navigation.core.trip.service.NavigationNotificationService.onStartCommand(NavigationNotificationService.kt:50) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5119) at android.app.ActivityThread.-$$Nest$mhandleServiceArgs() at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2474) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:222) at android.os.Looper.loop(Looper.java:314) at android.app.ActivityThread.main(ActivityThread.java:8779) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:569) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1090)

Caused by android.os.RemoteException: Remote stack trace: at com.android.server.am.ActiveServices.validateForegroundServiceType(ActiveServices.java:2750) at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:2461) at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:1752) at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:14064) at android.app.IActivityManager$Stub.onTransact$setServiceForeground$(IActivityManager.java:12784)

empratysg avatar Nov 25 '24 10:11 empratysg

Hi, we also experience this issue, any update so far?

leanh128 avatar Oct 13 '25 08:10 leanh128