The Share API provides methods for sharing content in any sharing-enabled apps the user may have installed.
The Share API works on iOS, Android, and the Web (using the new Web Share API), though web support is currently spotty.
import { Plugins } from '@capacitor/core';
const { Share } = Plugins;
let shareRet = await Share.share({
title: 'See cool stuff',
text: 'Really awesome thing you need to see right meow',
url: 'http://ionicframework.com/',
dialogTitle: 'Share with buddies',
});
Each platform uses a different set of fields, but you should supply them all.
share(options: ShareOptions) => Promise<any>
Show a Share modal for sharing content in your app with other apps
Param | Type |
---|---|
options |
ShareOptions |
Returns:
Promise<any>
Prop | Type | Description |
---|---|---|
title |
string |
Set a title for any message. This will be the subject if sharing to email |
text |
string |
Set some text to share |
url |
string |
Set a URL to share, can be http, https or file URL |
dialogTitle |
string |
Set a title for the share modal. Android only |