flutter_background_service icon indicating copy to clipboard operation
flutter_background_service copied to clipboard

Crash log in Google Play Console: id.flutter.flutter_background_service.BackgroundService.updateNotificationInfo - android.app.ForegroundServiceStartNotAllowedException

Open Ellynnn opened this issue 9 months ago • 4 comments

Hi, I'm having lots of the following crash logged into my Google Play Console.

Crash Log is as below: Exception java.lang.RuntimeException: Unable to create service id.flutter.flutter_background_service.BackgroundService: android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service <project id>/id.flutter.flutter_background_service.BackgroundService at android.app.ActivityThread.handleCreateService (ActivityThread.java:4991) at android.app.ActivityThread.-$$Nest$mhandleCreateService (Unknown Source) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2478) 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:8816) at java.lang.reflect.Method.invoke at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:569) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1090) Caused by android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service <project id>/id.flutter.flutter_background_service.BackgroundService at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel (ForegroundServiceStartNotAllowedException.java:54) at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel (ForegroundServiceStartNotAllowedException.java:50) at android.os.Parcel.readParcelableInternal (Parcel.java:4870) at android.os.Parcel.readParcelable (Parcel.java:4852) at android.os.Parcel.createExceptionOrNull (Parcel.java:3052) 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:7310) at android.app.Service.startForeground (Service.java:862) at androidx.core.app.ServiceCompat$Api34Impl.startForeground (ServiceCompat.java:239) at androidx.core.app.ServiceCompat.startForeground (ServiceCompat.java:172) at id.flutter.flutter_background_service.BackgroundService.updateNotificationInfo (BackgroundService.java:172) at id.flutter.flutter_background_service.BackgroundService.onCreate (BackgroundService.java:105) at android.app.ActivityThread.handleCreateService (ActivityThread.java:4978)

I'm currently using flutter_background_service 5.1.0 and Flutter version 3.27.4.

In my AndroidManifest.xml, I have also declared all of the following: <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" /> <service android:name="id.flutter.flutter_background_service.BackgroundService" android:foregroundServiceType="location" />

Can I know what is causing this issue and how can I solve this?

Ellynnn avatar Mar 11 '25 08:03 Ellynnn

Did you ever find a solution? I'm having the same issue

cole-bauml avatar Aug 07 '25 20:08 cole-bauml

@cole-bauml unfortunately no

Ellynnn avatar Aug 08 '25 00:08 Ellynnn

Unfortunately since this package is unmaintained it does not support any of the required changes by google

I switched to this package flutter_foreground_task beacuse its up to date

cole-bauml avatar Aug 20 '25 23:08 cole-bauml

Unfortunately since this package is unmaintained it does not support any of the required changes by google

I switched to this package flutter_foreground_task beacuse its up to date

Bro, with flutter_foreground_task has it not given you any problems about Android 15 required changes?

israUSA avatar Oct 28 '25 13:10 israUSA