# WebIntent ( Android 向け )

WebIntent プラグインを使用すれば、端末にインストールされている他のアプリを、Monaca アプリから起動できます。ここでは、例として、地図を表示するアプリを起動させます。

{% hint style="info" %}
このプラグインは、Android プラットフォーム専用です。
{% endhint %}

## プラグインの追加方法 ( Monaca 上での処理 )

1. Monaca クラウド IDE か&#x3089;**`設定 → Cordova プラグインの管理`**&#x3092;選択します。
2. *利用可能なプラグイン* 項目の `WebIntent` プラグインにカーソルを置き、`有効`ボタンをクリックします。

![](https://3046938759-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MfWrOnV1iKerkfShm9O%2F-MgOimsX0mtcN3VMbROR%2F-MgOj2u5XAsErhdEl0aB%2Fimage.png?alt=media\&token=f8c1e588-2383-495f-849d-611cdd13e618)

## WebIntent プラグインの使用例

```markup
<!DOCTYPE HTML>
<html>
<head>
  <title>WebIntent DEMO</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, user-scalable=no">
  <script src="components/loader.js"></script>
  <link rel="stylesheet" href="components/loader.css">

  <script type="text/javascript">
    function startActivity() {
      window.plugins.webintent.startActivity({
        action: window.plugins.webintent.ACTION_VIEW,
        url: 'geo:0, 0?q=' + 'dummy address'},
        function() {},
        function() {alert('Failed to open URL via Android Intent')}
    );
  }
  </script>
</head>
<body>
  <hr> WebIntent test <hr><br>
  <input type="button" onClick ="startActivity()" value ="startActivity()" /><br>

</body>
</html>
```

`"startActivity"` 関数の `"url"` 属性を使用して、起動させるアプリを指定できます。次に例を示します。

```javascript
//Call to the specified phone number
url: 'tel: phone_number=' + '03-5875-6862'

//Open the specified page in a browser
    url: 'http://www.asial.co.jp'

//Open the information of the 1st person in the contact
    url: 'content://contacts/people/1'
```

関連項目：

* [基本プラグイン](https://ja.docs.monaca.io/reference/core-cordova-plugins)
* [サードパーティー製プラグイン](https://ja.docs.monaca.io/reference/third_party_phonegap)
