# Cordova Social Sharing プラグイン

この Cordova プラグインでは、ソーシャルネットワーク、SMS、電子メール経由のテキスト、ファイル、画像、リンクを共有を行います。

* Repo: <https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin>
* Plugin ID/Package Name: `cordova-plugin-x-socialsharing`
* Tested Version: `6.0.4`
* Repo: <https://github.com/EddyVerbruggen/cordova-plugin-actionsheet>
* Plugin ID/Package Name: `cordova-plugin-actionsheet`
* Tested Version: `2.3.3`

{% hint style="info" %}
サードパーティー製 Cordova プラグインを確認する場合は、カスタムビルドデバッガー ( [Android 版](/products_guide/debugger/installation/debugger_android.md#kasutamubirudo-monaca-debaggnobirudotoinsutru) または [iOS 版](/products_guide/debugger/installation/debugger_ios.md#kasutamubirudo-monaca-debaggnobirudo) ) を作成する必要があります。

Android カスタムビルドデバッガーを使用する場合は、[ cordova-plugin-androidx-adapter ](https://github.com/dpa99c/cordova-plugin-androidx-adapter)をインポートするをインポートする必要があります。
{% endhint %}

## デモ

[<img src="https://docs.monaca.io/images/common/import_img.png" alt="" data-size="line">プロジェクトをインポート](https://monaca.mobi/ja/directimport?pid=64b12705e788859f1846f940)

![](/files/-MgyEEghy5gWv43lvLx7)

## Monaca クラウド IDE でプラグインを有効にする

1. IDE メニューか&#x3089;**`設定 → Cordova プラグインの管理`**&#x3078;移動します。
2. `Cordova プラグインのインポート`ボタンをクリックします。 次に、\[ZIP ファイル] または \[パッケージ名 / URL] を使用してプラグインをインポートします。

## API リファレンス

このページでは、[デモ](https://monaca.mobi/directimport?pid=5b29ede3e788853905dba6d9) で使用されている主な API についてのみ説明します。API リファレンスについては、[こちら](https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin) を参照してください。

### shareViaFacebook()

Facebook に共有する。

```javascript
window.plugins.socialsharing.shareViaFacebook(message, image, url)
```

{% hint style="info" %}
この機能を使用するには、端末の Facebook アプリで有効な認証が必要です。
{% endhint %}

**パラメーター**

| パラメーター名   | 型      | 説明          |
| --------- | ------ | ----------- |
| `message` | String | メッセージ       |
| `image`   | String | 画像のソース      |
| `url`     | String | Web サイトのURL |

{% hint style="info" %}
Facebookへの共有では `image` と `url` を同時に指定することはできません。

`image` を指定する場合は `url` は `null` を指定してください。
{% endhint %}

**戻り値**

* `Promise`

**例**

```javascript
  window.plugins.socialsharing.shareViaFacebook(
    'Sharing via Facebook', 
    img.src, 
    null
  );
```

### shareViaTwitter()

Twitter に共有する。

```javascript
window.plugins.socialsharing.shareViaTwitter(message, image, url)
```

{% hint style="info" %}
この機能を使用するには、端末の Twitter アプリで有効な認証が必要です。
{% endhint %}

**パラメーター**

| パラメーター名   | 型      | 説明          |
| --------- | ------ | ----------- |
| `message` | String | メッセージ       |
| `image`   | String | 画像のソース      |
| `url`     | String | Web サイトのURL |

**戻り値**

* `Promise`

**例**

```javascript
  window.plugins.socialsharing.shareViaTwitter(
    'Message and link via Twitter', 
    img.src, 
    "www.monaca.io" 
  );
```

### shareViaInstagram()

Instagram に共有する。

```javascript
window.plugins.socialsharing.shareViaInstagram(message, image)
```

{% hint style="info" %}
この機能を使用するには、端末の Instagram アプリに対する有効な認証が必要です。 この機能は、iOS では利用できません。
{% endhint %}

**パラメーター**

| パラメーター名   | 型      | 説明     |
| --------- | ------ | ------ |
| `message` | String | メッセージ  |
| `image`   | String | 画像のソース |

**戻り値**

* `Promise`

**例**

```javascript
  window.plugins.socialsharing.shareViaInstagram(
    'Message via Instagram', 
    img.src
  );
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ja.docs.monaca.io/tutorials/social_sharing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
