EddyVerbruggen / SocialSharing-PhoneGap-Plugin

👨‍❤️‍💋‍👨 Cordova plugin to share text, a file (image/PDF/..), or a URL (or all three) via the native sharing widget
MIT License
1.78k stars 909 forks source link

Bug when sharing message with image on android #169

Open MilesYM opened 10 years ago

MilesYM commented 10 years ago

Hello there,

When sharing a message with link and image, I'm facing a bug on Android.

It works perfectly fine on iPhone but with android wether its a text or whatsapp it only shares the image !?

Why's that ?

Phonegap V3.5.0 socialSharing plugin 4.3.0

The code I;m using:

    // Call the social sharing plugin.
    window.plugins.socialsharing.share( user.name + ' has invited you to go to ' + event.name + ' on ' + event.start + ' at ' + event.time_start + ' via the App. More info: ' + link, 'Invitation: ' + event.name, event.full_pic );

Am I doing something wrong ?

animista01 commented 10 years ago

Same problem here also with Android, in WhatsApp the URL isn't clickable is just text

ailmcm commented 10 years ago

Good day everyone, i found simple solution for proper sms. in [cordova project folder]/platforms/android/src/nl/xservices/plugins/SocialSharing.java file replace:

if (notEmpty(message)) {
          sendIntent.putExtra(android.content.Intent.EXTRA_TEXT, message);
}

with

if (notEmpty(message)) {
          sendIntent.putExtra(android.content.Intent.EXTRA_TEXT, message);
          sendIntent.putExtra("sms_body", message);
}

in lines 214-217. I must point Your attention that thi is rather robust hack. I used this stackoverflow answer: http://stackoverflow.com/questions/10490329/android-mms-intent-with-with-image-and-body-text

EddyVerbruggen commented 10 years ago

Thx @ailmcm, I've tested and added your code.

animista01 commented 10 years ago

I've found something weird on Android, when the url to share is for example a .land domain it doesn't share, .com domains works fine.