From a flutter app i am trying to pass an URI String( Created from some File content downloaded from net) to Android. Through

platform.invokeMethod

in Android i am trying to create intent with the URI string and pass it to StartActivity. I am getting exception.

android.content.ActivityNotFoundException: No Activity found to handle Intent

Below is partial code.

Intent fileIntent = new Intent(Intent.ACTION_VIEW);
                                fileIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
                                fileIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
                                fileIntent.addCategory(Intent.CATEGORY_DEFAULT);
                                fileIntent.setDataAndType(Uri.parse(call.argument("content")),
                                        "application/pdf");
                                fileIntent.setPackage("com.example.file_demo");
                                  if(fileIntent.resolveActivity(getActivity().getPackageManager())
                                  !=null) {
                                startActivity(fileIntent);}

Do we have to do any additional handling for a Flutter project?

0

There are 0 best solutions below