简体   繁体   中英

Can't share image from dataDirectory via SocialSharing-PhoneGap-Plugin

I have a Cordova android project and using SocialSharing-PhoneGap-Plugin to share images

I'm storing images in dataDirectory. But when sharing image, it won't shares!

window.plugins.socialsharing.share('', 'subject', window.cordova.file.dataDirectory + 'folder/image.jpg');

Share popup appears and I can select an app, subject will share but image won't!

If I share an image from www folder, it works fine.

I used share with image data method:

window.plugins.socialsharing.share(null, 'Android filename', 'data:image/png;base64,R0lGODlhDAAMALMBAP8AAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAUKAAEALAAAAAAMAAwAQAQZMMhJK7iY4p3nlZ8XgmNlnibXdVqolmhcRQA7', null);

Note: passing a base64 file as 'data:' is not supported on Android 2.x

You can see here how to Get base64 image data

我在最后的路径中添加files/它对我有用:

window.cordova.file.dataDirectory + 'files/folder/image.jpg'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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