I am performing background task to send users location to server after every 3 min. At the starting of the application i am asking for background location permission and while starting background service I am checking whether the permission has been given already or not?. If its given then only I am starting the background service. But, while starting permission was granted, but, now user put my application in the background and through settings app revoking the location permission. In this scenario application is crashing on android 14. But, on android 12 its working totally fine. Here I am sharing the crash report below,
Fatal Exception: java.lang.RuntimeException: Unable to start service com.asterinet.react.bgactions.RNBackgroundActionsTask@59c59be with Intent { cmp=com.delta.the.runner/com.asterinet.react.bgactions.RNBackgroundActionsTask (has extras) mCallingUid=10544 }: java.lang.SecurityException: Starting FGS with type location callerApp=ProcessRecord{a224dfd 27293:com.delta.the.runner/u0a544} 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:5134)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2481)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:368)
at android.app.ActivityThread.main(ActivityThread.java:8839)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
Any help regarding this issue is highly appreciated.
I am performing background task to send users location to server after every 3 min. At the starting of the application i am asking for background location permission and while starting background service I am checking whether the permission has been given already or not?. If its given then only I am starting the background service. But, while starting permission was granted, but, now user put my application in the background and through settings app revoking the location permission. In this scenario application is crashing on android 14. But, on android 12 its working totally fine. Here I am sharing the crash report below,
Fatal Exception: java.lang.RuntimeException: Unable to start service com.asterinet.react.bgactions.RNBackgroundActionsTask@59c59be with Intent { cmp=com.delta.the.runner/com.asterinet.react.bgactions.RNBackgroundActionsTask (has extras) mCallingUid=10544 }: java.lang.SecurityException: Starting FGS with type location callerApp=ProcessRecord{a224dfd 27293:com.delta.the.runner/u0a544} 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:5134)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2481)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:368)
at android.app.ActivityThread.main(ActivityThread.java:8839)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
Any help regarding this issue is highly appreciated.