summaryrefslogtreecommitdiff
path: root/StoneIsland/plugins/cordova-plugin-customurlscheme/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/plugins/cordova-plugin-customurlscheme/README.md')
-rw-r--r--StoneIsland/plugins/cordova-plugin-customurlscheme/README.md41
1 files changed, 39 insertions, 2 deletions
diff --git a/StoneIsland/plugins/cordova-plugin-customurlscheme/README.md b/StoneIsland/plugins/cordova-plugin-customurlscheme/README.md
index 2de829c2..d7222e90 100644
--- a/StoneIsland/plugins/cordova-plugin-customurlscheme/README.md
+++ b/StoneIsland/plugins/cordova-plugin-customurlscheme/README.md
@@ -1,6 +1,6 @@
# Custom URL scheme PhoneGap Plugin
#### launch your app by a link like this: `mycoolapp://`
-for iOS and Android, by [Eddy Verbruggen](http://www.x-services.nl)
+for iOS, Android and WP, by [Eddy Verbruggen](http://www.x-services.nl)
- This repo is for PhoneGap 3.0.0 and up
- For PhoneGap 2.9.0 and lower, [switch to the phonegap-2.9.0-and-lower branch](https://github.com/EddyVerbruggen/LaunchMyApp-PhoneGap-Plugin/tree/phonegap-2.9.0-and-lower)
@@ -10,11 +10,15 @@ for iOS and Android, by [Eddy Verbruggen](http://www.x-services.nl)
2. [Manually](https://github.com/EddyVerbruggen/LaunchMyApp-PhoneGap-Plugin#manually)
2. [PhoneGap Build](https://github.com/EddyVerbruggen/LaunchMyApp-PhoneGap-Plugin#phonegap-build)
3. [Usage](https://github.com/EddyVerbruggen/LaunchMyApp-PhoneGap-Plugin#3-usage)
+ 2. [iOS](https://github.com/EddyVerbruggen/LaunchMyApp-PhoneGap-Plugin#ios-usage)
+ 2. [Meteor](https://github.com/EddyVerbruggen/Custom-URL-scheme#meteor--getlastintent-android-only)
4. [URL Scheme hints](https://github.com/EddyVerbruggen/LaunchMyApp-PhoneGap-Plugin#4-url-scheme-hints)
5. [License](https://github.com/EddyVerbruggen/LaunchMyApp-PhoneGap-Plugin#5-license)
-### BEWARE: [This Apache Cordova issue](https://issues.apache.org/jira/browse/CB-7606) causes problems with Cordova-iOS 3.7.0: the `handleOpenURL` function is not invoked upon cold start. Use a higher or lower version than 3.7.0.
+### BEWARE:
+### - [This Apache Cordova issue](https://issues.apache.org/jira/browse/CB-7606) causes problems with Cordova-iOS 3.7.0: the `handleOpenURL` function is not invoked upon cold start. Use a higher or lower version than 3.7.0.
+### - As of iOS 9.2, the dialog `Open in "mycoolapp"?` no longer blocks JS, so if you have a short timeout that opens the app store, the user will be taken to the store before they have a chance to see and answer the dialog. [See below](https://github.com/EddyVerbruggen/LaunchMyApp-PhoneGap-Plugin#ios-usage) for available solutions.
## 1. Description
@@ -32,6 +36,8 @@ This plugin allows you to start your app by calling it with a URL like `mycoolap
### Android specifics
* Unlike iOS, there is no way to use config.xml to define a scheme for your app. Now there is.
* Tested on Android 4.3, will most likely work with 2.2 and up.
+* If you're trying to launch your app from an In-App Browser it opened previously, then [use this In-App Browser plugin fork](https://github.com/Innovation-District/cordova-plugin-inappbrowser) which allows that.
+* In case you have a multi-page app (multiple HTML files, and all implementing handleOpenURL), set the preference `CustomURLSchemePluginClearsAndroidIntent` to `true` in `config.xml` so the function won't be triggered multiple times. Note that this may interfere with other plugins requiring the intent data.
## 2. Installation
@@ -168,6 +174,37 @@ function handleOpenURL(url) {
A more useful implementation would mean parsing the URL, saving any params to sessionStorage and redirecting the app to the correct page inside your app.
All this happens before the first page is loaded.
+### iOS Usage
+A common method of deeplinking is to give the user the URL of a webpage (for instance http://linker.myapp.com/pathfoo) that opens the app if installed or the app store if not. This can be done in the following ways, depending on the desired UX:
+
+1. The page content has a button that says "Install app" and when clicked opens the app store by doing `location.href = 'itms-apps://itunes.apple.com/us/app/mycoolapp/idfoo'`. On page load, do `location.href = 'mycoolapp://pathfoo'`. If the user has the app, they will see a dialog that says `Open in "mycoolapp"? [Cancel] [Open]`. If the user does not have the app, they will see an alert that says `Cannot Open Page: Safari cannot open the page because the address is invalid`. Once they dismiss the alert, they see the button that opens the app store, and they tap it.
+2. The page has two buttons: one that opens the app, and one that opens the app store.
+3. On page load, open a Universal Link using [cordova-universal-links-plugin](https://github.com/nordnet/cordova-universal-links-plugin). (A Universal Link either opens the app or the app store.) Then fall back to one of the above methods if Univeral Links is not supported.
+
+You can also use a service that provides pages that do #3 for you, such as [Branch](https://branch.io/).
+
+### CSP - or: `handleOpenURL` doesn't work
+The Whitelist plugin will prevent inline JS from executing, unless you whitelist the url scheme. Please see [this SO issue](http://stackoverflow.com/questions/34257097/using-handleopenurl-with-custom-url-scheme-in-cordova/34281420#34281420) for details.
+
+### Meteor / getLastIntent (Android only)
+When running a [meteor](meteor.com) app in the cordova environment, `handleOpenURL` doesn't get called after a cold start, because cordova resets the javascript world during startup and our timer waiting for `handleOpenURL` gets vanished (see [#98](https://github.com/EddyVerbruggen/Custom-URL-scheme/issues/98)). To get the intent by which the app was started in a meteor cordova app you need to ask for it from the meteor side with `getLastIntent` like this.
+```javascript
+Meteor.startup(function() {
+ if (Meteor.isCordova) {
+ window.plugins.launchmyapp.getLastIntent(function(url) {
+ if (intent.indexOf('mycoolapp://' > -1)) {
+ console.log("received url: " + url);
+ } else {
+ return console.log("ignore intent: " + url);
+ }
+ }, function(error) {
+ return console.log("no intent received");
+ });
+ return;
+ }
+});
+```
+
## 4. URL Scheme hints
Please choose a URL_SCHEME which which complies to these restrictions:
- Don't use an already registered scheme (like `fb`, `twitter`, `comgooglemaps`, etc).