email composer ionic插件在电子邮件中上传pdf文件时出错

时间:2018-10-08 13:53:05

标签: java angular ionic-framework

File file= /data/user/0/com.sample.sample/files/sample.pdf;
ctx=com.sample.sample.MainActivity@83bff6c;
private Uri getUriForFile(Context ctx, File file) {
    String authority = ctx.getPackageName() + ".provider";
    System.out.println(authority+"aravindannew");
    System.out.println(ctx.toString());

    try {
       return Provider.getUriForFile(ctx, authority, file);
    } 
    catch (Exception e) {
       e.printStackTrace();
       return Uri.EMPTY;
    }
}

遇到错误

  

W / System.err:java.lang.IllegalArgumentException:找不到   配置的根包含   /data/data/com.sample.sample/files/sample.pdf           在android.support.v4.content.FileProvider $ SimplePathStrategy.getUriForFile(FileProvider.java:738)           在android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:417)           在de.appplant.cordova.emailcomposer.AssetUtil.getUriForFile(AssetUtil.java:280)           在de.appplant.cordova.emailcomposer.AssetUtil.getUriForAbsolutePath(AssetUtil.java:117)           在de.appplant.cordova.emailcomposer.AssetUtil.parse(AssetUtil.java:88)           在de.appplant.cordova.emailcomposer.Impl.setAttachments(Impl.java:202)           在de.appplant.cordova.emailcomposer.Impl.getDraft(Impl.java:97)           在de.appplant.cordova.emailcomposer.EmailComposer.open(EmailComposer.java:151)

0 个答案:

没有答案