dispatch:deep-link
This package enables deep linking to cordova or browser app.
Install
$ meteor add dispatch:deep-link
Basic usage
Configuration
Edit your mobile-config.js
App.configurePlugin('cordova-plugin-customurlscheme', { URL_SCHEME: 'mycoolapp' });
Usage
Create an iosBanner
or have a link
for the user to click on - when the app recieves the link you can catch it like:
1 2 DeepLink.once('mycoolapp', function(data, url, scheme, path, querystring){ 3 alert('Got some deep linked data...'); 4 }); 5
Have a look at the QA/Demo app
Additional api / helpers
Thers added an extra api of helpers making it easy to send data to the app:
link(path, data)
generates a url stringbrowserLink(path, data)
(requires url to be set)open(path, data)
opens app using window.openiosBanner(path, data)
add/update ios banner meta tag
Example code
1 var myCoolApp = new DeepLink('mycoolapp', { 2 // Optional 3 appId: 'me.dispatch.qa.test.deep.link', 4 url: 'http://foo.com', // Homepage with intent support 5 fallbackUrl: 'http://meteor.com' // Only android 6 }); 7 8 myCoolApp.link('', { foo: 'bar' }); // This will generate the url to the app 9 myCoolApp.open('', { foo: 'bar' }); // This will open via window.open 10 myCoolApp.iosBanner('', { foo: 'bar' }); // This will add/update the meta tag for ios users 11 12 // This will use base64 ejson to carry the data - because it contains nested data 13 myCoolApp.link('path', { foo: 'bar', date: new Date() }); 14 15 // To create a browser intent 16 myCoolApp.browserLink('', { foo: 'bar' });
Read more in ADVANCED.md
Credit
Thanks goes to Eddy Verbruggen for his Custom URL scheme PhoneGap Plugin