SocialSharing PhoneGap插件URL_NOT_SUPPORTED

时间:2015-03-11 06:33:18

标签: 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);

然后得到以下错误:

  

文件:///android_asset/www/plugins/nl.x-services.plugins.socialsharing/www/SocialSharing.js:   第93行:'共享'的注入错误回调好评:   " URL_NOT_SUPPORTED"

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

File myImageFile= new File(context.getDir("images", Context.MODE_PRIVATE), "myimage.jpg");

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

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

1 个答案:

答案 0 :(得分:5)

我遇到了类似的问题并通过使用file://

明确地预先添加文件路径来解决它
if(application.isAndroid) {
   filePath = 'file://' + filePath;
}
相关问题