By following the below code you should be able to write ionic code to share your app on WhatsApp and other social platforms:
Install the following plugin:
npm install @capacitor/share
npx cap sync
HTML code:
<ion-button slot="end" color="light" (click)="shareApp()">
Share
<ion-icon slot="end" name="share-social"></ion-icon>
</ion-button>
TS code:
import { Share } from '@capacitor/share';
async shareApp() {
try {
await Share.canShare().then((resp) => {
if (resp.value) {
Share.share({
title: 'English Puzzles',
text: 'English Puzzles - Play with your friends and
family members.',
url: 'https://play.google.com/store/apps/details?
id=com.bospp.englishPuzzles',
dialogTitle: 'Share with buddies',
});
}
});
} catch (error) {
}
}
No comments:
Post a Comment