Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap config.xml - the unexplained intents

Tags:

cordova

The Phonegap/Cordova documentation by and large does a great job of explaining the purpose of the various intents and other bits in the config.xml file. However, I have been unable to establish the meaning/use of the following

<platform name="android">
    <allow-intent href="market:*" />
</platform>
<platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
</platform>

I'd be most grateful to anyone who might be able to explain what they are meant to do.

like image 329
DroidOS Avatar asked Oct 09 '15 12:10

DroidOS


1 Answers

From the whitelist plugin documentation:

Intent Whitelist

Controls which URLs the app is allowed to ask the system to open. By default, no external URLs are allowed.

On Android, this equates to sending an intent of type BROWSEABLE.

This whitelist does not apply to plugins, only hyperlinks and calls to window.open().

Basically, it is what types urls are allowed to be opened with window.open(), so in your example:

<platform name="android">
    <allow-intent href="market:*" />
</platform>
<platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
</platform>

the app would be able to open the Android Play Store and App store on iOS. The links (market:) will allow links to other apps in the play store (see Stack overflow question How to open the Google Play Store directly from my Android application?), and the (itms:) allows links to apps in the itunes App Store. This is probably required if you using any advertising plugin that redirects users to install apps. These url schemes are pre-registered in Andriod and iOS by Google and Apple respectively.

like image 84
Kris Erickson Avatar answered Oct 12 '22 20:10

Kris Erickson