Skip to content

can't run package in flutter_background_service #947

Answered by CaiJingLong
farhadadarbar asked this question in Q&A
Discussion options

You must be logged in to vote

In Android, the access permission itself depends on the Activity, so the code contains the code for dynamic permission checking, which requires your FlutterView to be Attached to an Activity, and it is performed according to the standard Android specification (that is, the channel called by each dart methods are wrapped in code for dynamic permission checking).

And your background service does not seem to depend on Activity, so you need to use ignorePermissionCheck to ignore PhotoManager's permission check on the premise of ensuring that you have permission.

// Call the method to ignore permission check
await PhotoManager.setIgnorePermissionCheck(true);

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by CaiJingLong
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
3 participants
Converted from issue

This discussion was converted from issue #939 on July 17, 2023 07:20.