Ionic 2: capture screenshot and social sharing
In Ionic 2, if you want to capture screenshot and send it or share it via Social Network, you can follow these steps below:
// First import
// Second in constructor
// Now do it
// Share Facebook
// share via twitter
// Share via Email (Gmail included)
Enjoy!
// First import
import { Screenshot } from '@ionic-native/screenshot';
import { SocialSharing } from '@ionic-native/social-sharing';
// Second in constructor
constructor(
//....
private screenshot: Screenshot,
private socialSharing: SocialSharing,
//....
) {
}
// Now do it
// Share Facebook
this.screenshot.URI().then((res) => {
this.socialSharing.shareViaFacebookWithPasteMessageHint(body, res.URI, link, bodyHint).then(() => {});
});
// share via twitter
this.screenshot.URI().then((res) => {
this.socialSharing.shareViaTwitter(body, res.URI, link).then(() => {});
});
// Share via Email (Gmail included)
this.screenshot.URI().then((res) => {
this.socialSharing.shareViaEmail(body + ' ' + link, '', [], null, null, res.URI).then(() => {});
});
});
Enjoy!
Property 'URI' does not exist on type 'typeof Screenshot'.
ReplyDeleteThanks, Dude! It helped a lot!
ReplyDeleteThe first step is the user needs to visit the link which is given here
ReplyDeletemobiloans login