- 98 Posts
- 0 Reply Likes
Posted 6 years ago
John Weidner, Champion
- 435 Posts
- 80 Reply Likes
In your config.xml you'd need to add the following:
<gap:plugin name="net.tunts.webintent" />
In your index.html you could add:
<script>
function testWebIntent() {
address = "1600+Amphitheatre+Parkway%2C+CA" ;
window.plugins.webintent.startActivity({
action: window.plugins.webintent.ACTION_VIEW,
url: 'geo:0,0?q=' + address},
function() {alert('success')},
function() {alert('Failed to open URL via Android Intent')}
);
}
</script>
<button onclick='testWebIntent()'>Test WebIntent</button>John Weidner, Champion
- 435 Posts
- 80 Reply Likes
window.plugins.webintent.startActivity({
action: window.plugins.webintent.ACTION_VIEW,
url: 'whatsapp://send?text=Hello%20World!'
},
function() {alert('success')},
function(errorMsg) {alert('Failed to startActivity errorMsg=' + errorMsg)}
);- 98 Posts
- 0 Reply Likes
John Weidner, Champion
- 435 Posts
- 80 Reply Likes
- 98 Posts
- 0 Reply Likes
John Weidner, Champion
- 435 Posts
- 80 Reply Likes
- 98 Posts
- 0 Reply Likes
John Weidner, Champion
- 435 Posts
- 80 Reply Likes
John Weidner, Champion
- 435 Posts
- 80 Reply Likes
function(errorMsg) {alert('Failed to startActivity errorMsg=' + errorMsg)}. So if the output you see doesn't also have the "errorMsg=" text, then you must not have copied, built, or installed the above code. If you use the above, then the errorMsg displayed might give us more clue as to what's wrong.- 98 Posts
- 0 Reply Likes
this is the full error message
"failed to start activity errormsg=No Activity found to handle intent{act=android.intent.action.View dat=whatsapp://send?text=Hello WORLD!}
THIS IS what i did that gave me that error message
<script type="text/javascript">
function app() {
window.plugins.webintent.startActivity({
action: window.plugins.webintent.ACTION_VIEW,
url: 'whatsapp://send?text=Hello%20World!'
},
function() {alert('success')},
function(errorMsg) {alert('Failed to startActivity errorMsg=' + errorMsg)}
);
}
</script>
<button onclick='app()'>whatsapp</button>John Weidner, Champion
- 435 Posts
- 80 Reply Likes
- 98 Posts
- 0 Reply Likes
John Weidner, Champion
- 435 Posts
- 80 Reply Likes
- 98 Posts
- 0 Reply Likes
John Weidner, Champion
- 435 Posts
- 80 Reply Likes
- 98 Posts
- 0 Reply Likes
John Weidner, Champion
- 435 Posts
- 80 Reply Likes
<script type="text/javascript">
function launchWhatsApp() {
window.plugins.webintent.startActivity({
action: window.plugins.webintent.ACTION_VIEW,
url: 'whatsapp://send?text=Hello%20World!'
},
function() {alert('success')},
function(errorMsg) {
console.log('Failed to startActivity errorMsg=' + errorMsg);
launchMarketForWhatsApp();
}
);
}
function launchMarketForWhatsApp() {
window.plugins.webintent.startActivity({
action: window.plugins.webintent.ACTION_VIEW,
url: 'market://details?id=com.whatsapp'
},
function() {alert('success')},
function(errorMsg) {
console.log('Failed to startActivity errorMsg=' + errorMsg);
}
);
}
</script>
<button onclick='launchWhatsApp()'>whatsapp</button>Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
[It's not always a great idea to ask the same question simultaneously in multiple threads]
- 2 Posts
- 0 Reply Likes
your code is working fine. but i want to open my own app so please help me?
John Weidner, Champion
- 435 Posts
- 80 Reply Likes
- 2 Posts
- 0 Reply Likes
i try your suggested plugin but its not working properly.
below are the code of my config.xml :
<gap:plugin name="nl.x-services.plugins.launchmyapp">
<param name="URL_SCHEME" value="stsprinter" />
</gap:plugin>
<feature name="Custom URL scheme">
<param name="id" value="nl.x-services.plugins.launchmyapp" />
<param name="url" value="https://github.com/EddyVerbruggen/LaunchMyApp-PhoneGap-Plugin.git" />
<variable name="URL_SCHEME" value="stsprinter" /><!-- change as appropriate -->
</feature>
</pre>
and my .html file code is:
<script>
function launchApp() {
window.plugins.webintent.startActivity({
action: window.plugins.webintent.ACTION_VIEW,
url: 'stsprinter://'
},
function() {alert('success1')},
function(errorMsg) {
alert('false')
}
);
}
</script>
Open the other app
can u please guide me for the same.
thanks in advance,
mayur
Related Categories
-
PhoneGap Build
- 15111 Conversations
- 275 Followers
-
Plugins
- 1283 Conversations
- 38 Followers
_large.jpg)




stack stack
i tried this
<input type="button" onclick="javascript:whatsapp();" value="whatsapp">
</div>
<script type="text/javascript" src="phonegap.js"></script>
<script type="text/javascript" src="webintent.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
app.initialize();
function whatsapp() {
alert('open');
window.plugins.webintent.startActivity({
action: 'com.whatsapp'},
function() {alert('Started!?');},
function() {alert('Failed to open URL via Android Intent');}
);
}
</script>
and i keep getting "Failed to open URL via Android Intent"
how do i solve this.
John Weidner, Champion
Maybe one of the other WebIntent plugins would work. Or maybe we can get the author of this plugin to update his.
stack stack