SocialSharing PhoneGap插件URL_NOT_SUPPORTED

San*_*mar 2 android cordova cordova-plugins

我正在使用此插件在我的Android Phonegap项目上共享图像. https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin

为了共享图像,我使用这些参数调用插件

window.plugins.socialsharing.share('Title', null,'/data/data/com.example.app/images/myimage.jpg', null);
Run Code Online (Sandbox Code Playgroud)

然后得到以下错误:

file:///android_asset/www/plugins/nl.x-services.plugins.socialsharing/www/SocialSharing.js:第93行:收到的'share'注入的错误回调:"URL_NOT_SUPPORTED"

我尝试共享的图像文件是使用Context.MODE_PRIVATE权限创建的.

File myImageFile= new File(context.getDir("images", Context.MODE_PRIVATE), "myimage.jpg");
Run Code Online (Sandbox Code Playgroud)

我怀疑其中一个可能是失败的原因:

  1. 该插件无法正常工作,因为我以错误的方式传递图像uri?
  2. 插件看不到图像,因为它是使用MOD_PRIVATE创建的

小智 5

我遇到了类似的问题并通过使用file://明确地预先添加文件路径来解决它

if(application.isAndroid) {
   filePath = 'file://' + filePath;
}
Run Code Online (Sandbox Code Playgroud)