Ionic Launch Event. September 28th 2021.

DocsプラグインCLI
pwaiosandroid

Share

Share API は、ユーザーがインストールした可能性のある共有対応なアプリでコンテンツを共有するためのメソッドを提供します。

Share API は、iOS、Android、Web で利用することができます(新しいWeb Share APIを利用しますが、すべてのブラウザで利用できるわけではありません)。

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

Param Type
options ShareOptions

Returns: Promise<any>


Interfaces

ShareOptions

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
Previous
<- Push Notifications
Next
Splash Screen ->
Contribute ->