ekasetiawans / flutter_background_service

269 stars 189 forks source link

java.lang.IllegalStateException: Not allowed to start service Intent #259

Open Haris2v opened 1 year ago

Haris2v commented 1 year ago

We are facing this issue on some android devices, especially Samsung. This issue is appearing 98% in the background mode.

I'm using: flutter_background_service: ^2.1.3

Here is the error: Fatal Exception: java.lang.RuntimeException: Unable to start receiver id.flutter.flutter_background_service.WatchdogReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.example.app/id.flutter.flutter_background_service.BackgroundService }: app is in background uid UidRecord{e2c8c82 u0a238 RCVR bg:+16m16s340ms idle change:uncached procs:1 seq(138,138,138)} at android.app.ActivityThread.handleReceiver(ActivityThread.java:3400) at android.app.ActivityThread.access$1200(ActivityThread.java:205) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1667) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:280) at android.app.ActivityThread.main(ActivityThread.java:6706) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

and my flutter doctor is: [✓] Flutter (Channel stable, 3.3.7, on macOS 11.7 20G817 darwin-x64, locale en-GB) [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2021.3) [✓] VS Code (version 1.71.2)

wzg-githome commented 1 year ago

@Haris2v I also met the same problem. Have you solved it

QinGuiCheng commented 1 year ago

@Haris2v I also met the same problem. Have you solved it

tiesariatzori commented 1 year ago

@Haris2v estou com mesmo problema e estou com versão mais atualizada do flutter_background_service.

QinGuiCheng commented 1 year ago

@tiesariatzori Hello, has this problem been solved?

wasibdev commented 1 year ago

Same here. please share some information if you solved the issue. Thanks

razfazz commented 1 year ago

same issue here

razfazz commented 1 year ago

i found out that this issue only appears when using isForegroundMode: false,

1encore commented 8 months ago

@razfazz I reject that, it appears on any value of isForegroundMode