Skip to content

2 Taskhandler with different permission, Causing crash #318

@GaneshPokaleFittr

Description

@GaneshPokaleFittr

I have 2 Different services, One is used for "location", and another is using for "datasync"

<service android:name="com.pravera.flutter_foreground_task.service.ForegroundService" android:foregroundServiceType="location|dataSync" android:exported="false" />

I have given all required permission but(Location all the time), But when GPS is off and I execute "datasync" task through FCM, the App crashes

"java.lang.RuntimeException: Unable to start service com.pravera.flutter_foreground_task.service.ForegroundService@ff60998 with Intent { cmp=com.my.package/com.pravera.flutter_foreground_task.service.ForegroundService }: java.lang.SecurityException: Starting FGS with type location callerApp=ProcessRecord{1ff29bc 26798:com.my.package/u0a546} targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_LOCATION] any of the permissions allOf=false [android.permission.ACCESS_COARSE_LOCATION, android.permission.ACCESS_FINE_LOCATION] and the app must be in the eligible state/exemptions to access the foreground only permission

How to handle this type of situation, there must need one way to define foreground service type at runtime for specific taskhandler

Metadata

Metadata

Assignees

No one assigned

    Labels

    resolved-pending-releaseThe issue has been resolved, but it hasn't been released yet.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions