Monaca Docs
Search…
WebIntent Plugin (Android)
WebIntent plugin lets you start an installed application from within Monaca application. The following sample will start an app that will display a map.
This plugin is available only to Android platform.

Enable Plugin in Monaca

    1.
    From the IDE menu, go to Configure → Cordova Plugin Settings.
    2.
    Under Available Plugins section, hover over the WebIntent plugin and click Enable button.

WebIntent Plugin Demo

1
<!DOCTYPE HTML>
2
<html>
3
<head>
4
<title>WebIntent DEMO</title>
5
<meta charset="utf-8">
6
<meta name="viewport" content="width=device-width, user-scalable=no">
7
<script src="components/loader.js"></script>
8
<link rel="stylesheet" href="components/loader.css">
9
10
<script type="text/javascript">
11
function startActivity() {
12
window.plugins.webintent.startActivity({
13
action: window.plugins.webintent.ACTION_VIEW,
14
url: 'geo:0, 0?q=' + 'dummy address'},
15
function() {},
16
function() {alert('Failed to open URL via Android Intent')}
17
);
18
}
19
</script>
20
</head>
21
<body>
22
<hr> WebIntent test <hr><br>
23
<input type="button" onClick ="startActivity()" value ="startActivity()" /><br>
24
25
</body>
26
</html>
Copied!
Using "url" attribute of the "startActivity" function, an app can specify the target app to be launched. Here are some examples:
1
//Call to the specified phone number
2
url: 'tel: phone_number=' + '03-5875-6862'
3
4
//Open the specified page in a browser
5
url: 'http://www.asial.co.jp'
6
7
//Open the information of the 1st person in the contact
8
url: 'content://contacts/people/1'
Copied!
See Also:
Last modified 2mo ago