简体   繁体   English

SocialSharing PhoneGap插件URL_NOT_SUPPORTED

[英]SocialSharing PhoneGap Plugin URL_NOT_SUPPORTED

I am using this plugin for sharing images on my Android Phonegap project. 我正在使用此插件在Android Phonegap项目上共享图像。 https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin

To share an image I am calling plugin with these parameters 要共享图像,我正在使用这些参数调用插件

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

and then getting the below error: 然后得到以下错误:

file:///android_asset/www/plugins/nl.x-services.plugins.socialsharing/www/SocialSharing.js: Line 93 : The injected error callback of 'share' received: "URL_NOT_SUPPORTED" file:///android_asset/www/plugins/nl.x-services.plugins.socialsharing/www/SocialSharing.js:第93行:收到了“ share”的注入错误回调:“ URL_NOT_SUPPORTED”

The image file that I am trying to share was created with Context.MODE_PRIVATE permission. 我尝试共享的图像文件是使用Context.MODE_PRIVATE权限创建的。

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

I doubt that one of these could be possible reason for the failure: 我怀疑其中之一可能是失败的原因:

  1. The plugin is not working because I am passing the image uri in wrong way? 插件无法正常工作,因为我以错误的方式传递了图像uri?
  2. The image is not visible to the plugin because it was created with MOD_PRIVATE 该图像对插件不可见,因为它是使用MOD_PRIVATE创建的

I was having a similar issue and solved it by explicitly prepending the filepath with file:// 我遇到了类似的问题,并通过在文件路径前显式添加file://来解决了该问题

if(application.isAndroid) {
   filePath = 'file://' + filePath;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM