メインコンテンツまでスキップ
バージョン: v2

Share

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.

Example

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.

API

share(...)

share(options: ShareOptions) => Promise<any>

Show a Share modal for sharing content in your app with other apps

ParamType
options
ShareOptions

Returns: Promise<any>


Interfaces

ShareOptions

PropTypeDescription
titlestringSet a title for any message. This will be the subject if sharing to email
textstringSet some text to share
urlstringSet a URL to share, can be http, https or file URL
dialogTitlestringSet a title for the share modal. Android only