Reputation: 21862
In the past, if I wanted to navigate directly to an app in the Google Play store from a PhoneGap app, I would do the following:
location.href = 'market://details?id=my_package.my_app_name'
Now if I try to do that in my Cordova app (I'm now using Cordova 4.1.2), it just picks it's nose (no errors, just silently fails to navigate there).
I've verified that it is reaching the code before and after location.href = "..."
.
Does Cordova now have a new/different way of navigating to the google store? or new required permissions? Or is it just not possible anymore?
Upvotes: 3
Views: 2076
Reputation: 1
Test cordova version 9
Install it:
cordova plugin add org.apache.cordova.inappbrowser
javascript:
var market='market://details?id=com.***.***&referrer=utm_source=****&utm_medium=appupdatev11&utm_campaign=plugin';
cordova.InAppBrowser.open(market, '_system');
use it with "_system" option open googlePlay
Upvotes: 0
Reputation: 53301
Cordova added some security changes that don't allow to navigate to some links like you did before.
Now you have two options to open other app:
Fist one, as mentioned by Dato, inAppBrowser plugin
Install it:
cordova plugin add org.apache.cordova.inappbrowser
use it with _system option:
window.open('market://details?id=my_package', '_system');
or:
window.open('http://play.google.com/store/apps/details?id=my_package', '_system');
Other option it to whitelist the url
<access origin="market:*" launch-external="yes" />
http://cordova.apache.org/docs/en/4.0.0/guide_appdev_whitelist_index.md.html
Upvotes: 4
Reputation: 554
What Dato meant with his answer is: you can use cordova app browser and then point the link to a play store application, which will open automatically (just like an add of other apps inside some apps).
His code is correct.
Upvotes: 0
Reputation: 23883
You can use cordova app browser.
https://github.com/apache/cordova-plugin-inappbrowser/blob/master/doc/index.md
code
var ref = window.open('http://apache.org', '_blank', 'location=yes');
var ref2 = window.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
Upvotes: 2