3

I am using the flutter file picker 6.0.0.When i try to select file from the picker file.I used singleInstance in manifest.

 FilePickerResult? result = await FilePicker.platform.pickFiles(allowedExtensions: ['jpg','jpeg','png','pdf'],type: FileType.custom);
if (result != null) {
  File file = File(result.files.single.path!);
  controller.isPasswordProtected.value =
      await FileHelper.checkFileIsPasswordProtected(file);
  controller.fileSelected(file);
  controller.uploadDocument();
}

1 Answer 1

4
+100

It looks like this is expected behavior on Android, you can see here. If the calling app forbids other activities in its task, then it can't get results from other activities.

Related flutter plugin image_picker is also mentioning about singleInstance launch mode :

Launching the image picker from an Activity with launchMode: singleInstance will always return RESULT_CANCELED. In this launch mode, new activities are created in a separate Task. As activities cannot communicate between tasks, the image picker activity cannot send back its eventual result to the calling activity. To work around this problem, consider using launchMode: singleTask instead.

Read the details here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.