ekasetiawans / flutter_background_service

268 stars 188 forks source link

Unable to create service id.flutter.flutter_background_service.BackgroundService: #421

Open shinewanna opened 7 months ago

shinewanna commented 7 months ago

Receiving this issue from crashlyics. How to fix this issue?

Fatal 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 com.example.app/id.flutter.flutter_background_service.BackgroundService
fronald commented 6 months ago

Add permission:

    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
shinewanna commented 6 months ago

My app already has that permission.

sagar1garg commented 4 months ago

Any solution to this? I am getting the same issue when app is closed.

fronald commented 2 months ago

Yep. I'ill close this issue.

The problem was that in my pubspec file there were references to flutter_background_service and background_processes. I removed background_processes and everything worked as expected. Therefore, the problem was this conflict. When encountering this error, check if there is any other functionally conflicting library in the pubspec, such as background_processes, flutter_foreground_tasks, etc.

lollipopkit commented 2 months ago

Same issue, but permission added and no conflict lib (i guess)

image