Sharing Screenshot with SocialSharing not working

Hi all,

Having a strange issue where the I am unable to share a screenshot using the cordova plugin SocialSharing.

I am wondering has anyone else had a similar issue. I am of course testing this on my physical device.

When I click share and select WhatsApp, the fails and says ‘sharing failed’

Code below:

 this.screenshot.URI(80).then((res) => {
            SocialSharing.share('test message', 'test', res.URI, null).then(null, (err) => {
                let alert = this._alertCtrl.create({
                    title: 'Ooops!',
                    subTitle: err,
                    buttons: ['OK']
                })
            });
        }, (err) => {
            let alert = this._alertCtrl.create({
                title: 'Ooops!',
                subTitle: err,
                buttons: ['OK']
            });
            console.log(err);
        });

Any help greatly appreciated.

Could you please provide links to the plugins (and Ionic native wrappers if you use those) you are using?

The plugins I am using are:
cordova-plugin-x-socialsharing
Ionic Screenshot

I am unsure what the problem is. Social Sharing works as expected when sharing simple text, but not with an image.

How exactly does it say “sharing failed”? I don’t see this error message in your code.
The cordova-plugin-x-socialsharing README has an error message like that, but also outputs some further information. Did you try that?

Yes the error message that is being displayed is coming from the plugin. I added an error callback handler to output the error message but it didn’t contain any additional information so not much help there.

I don’t think the error is related to the SocialSharing plugin. I feel its related to the Screenshot plugin. I will debug further and test using a sample image stored on my phone rather than the screenshot. At least that will rule out the SocialSharing plugin. It could be something related to sharing a image on WhatsApp.

I appreciate the help Sujan.

1 Like

Any luck getting the screenshot to work? I’m essentially using the same code as you.

any updates for this problem :frowning: