Dev-hwang / flutter_foreground_task

This plugin is used to implement a foreground service on the Android platform.
https://pub.dev/packages/flutter_foreground_task
MIT License
140 stars 105 forks source link

Crash on foregroundServiceType="connectedDevice" #222

Closed mening12001 closed 1 month ago

mening12001 commented 3 months ago

It seems that only foregroundServiceType="dataSync" is accepted. If I set foregroundServiceType to "connectedDevice", I receive the following exception:

java.lang.RuntimeException: Unable to create service com.pravera.flutter_foreground_task.service.ForegroundService: java.lang.IllegalArgumentException: foregroundServiceType 0x00000001 is not a subset of foregroundServiceType attribute 0x00000010 in service element of manifest file E/AndroidRuntime(12325): Caused by: java.lang.IllegalArgumentException: foregroundServiceType 0x00000001 is not a subset of foregroundServiceType attribute 0x00000010 in service element of manifest file

Please participate, what could be the issue?

mening12001 commented 3 months ago

I had to also set here the type that I set in the manifest: FlutterForegroundTask.init( androidNotificationOptions: AndroidNotificationOptions( foregroundServiceType: AndroidForegroundServiceType.CONNECTED_DEVICE,.....

Dev-hwang commented 1 month ago

Does the same problem occur with the latest update?

Dev-hwang commented 1 month ago

move issue #226