Lyokone/flutterlocation

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, Service.startForeground() not allowed due to mAllowStartForeground false: service com.xxx.app/com.lyokone.location.FlutterLocationService

Opened this issue · 0 comments

Hi, can you help me to understand this error please?
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, Service.startForeground() not allowed due to mAllowStartForeground false: service com.xxx.app/com.lyokone.location.FlutterLocationService, null, android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service com.xxx.app/com.lyokone.location.FlutterLocationService
E/flutter (30801): at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:54)
E/flutter (30801): at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:50)
E/flutter (30801): at android.os.Parcel.readParcelable(Parcel.java:3334)
E/flutter (30801): at android.os.Parcel.createExceptionOrNull(Parcel.java:2421)
E/flutter (30801): at android.os.Parcel.createException(Parcel.java:2410)
E/flutter (30801): at android.os.Parcel.readException(Parcel.java:2393)
E/flutter (30801): at android.os.Parcel.readException(Parcel.java:2335)
E/flutter (30801): at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7343)
E/flutter (30801): at android.app.Service.startForeground(Service.java:733)
E/flutter (30801): at com.lyokone.location.FlutterLocationService.enableBackgroundMode(FlutterLocationService.kt:242)
E/flutter (30801): at com.lyokone.location.MethodCallHandlerImpl.enableBackgroundMode(MethodCallHandlerImpl.java:169)
E/flutter (30801): at com.lyokone.location.MethodCallHandlerImpl.onMethodCall(MethodCallHandlerImpl.java:61)
E/flutter (30801): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
E/flutter (30801): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
E/flutter (30801): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/flutter (30801): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/flutter (30801): at android.os.Handler.handleCallback(Handler.java:938)
E/flutter (30801): at android.os.Handler.dispatchMessage(Handler.java:99)
E/flutter (30801): at android.os.Looper.loopOnce(Looper.java:210)
E/flutter (30801): at android.os.Looper.loop(Looper.java:299)
E/flutter (30801): at android.app.ActivityThread.main(ActivityThread.java:8319)
E/flutter (30801): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (30801): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
E/flutter (30801): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1038)
E/flutter (30801): Caused by: android.os.RemoteException: Remote stack trace:
E/flutter (30801): at com.android.server.am.ActiveServices.setServiceForegroundInnerLocked(ActiveServices.java:1894)
E/flutter (30801): at com.android.server.am.ActiveServices.setServiceForegroundLocked(ActiveServices.java:1403)
E/flutter (30801): at com.android.server.am.ActivityManagerService.setServiceForeground(ActivityManagerService.java:12331)
E/flutter (30801): at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:3318)
E/flutter (30801): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2561)
E/flutter (30801):
E/flutter (30801): )