Sandeep Kumar
Sandeep Kumar

Reputation: 1283

SocialSharing PhoneGap Plugin URL_NOT_SUPPORTED

I am using this plugin for sharing images on my Android Phonegap project. 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"

The image file that I am trying to share was created with Context.MODE_PRIVATE permission.

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?
  2. The image is not visible to the plugin because it was created with MOD_PRIVATE

Upvotes: 3

Views: 2266

Answers (1)

Ken Hoes
Ken Hoes

Reputation: 71

I was having a similar issue and solved it by explicitly prepending the filepath with file://

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

Upvotes: 7

Related Questions