by.redstream.referrer
v0.1.3
Published
Android Install Referrer
Downloads
8
Maintainers
Readme
Android Install Referrer
This plugin captures the referrer value passed when an android app is installed from a webpage.
Install
cordova plugins add by.redstream.referrer
Usage
To use this plugin, add &referrer=xyz
to app install links on your webpages. For example:
https://play.google.com/store/apps/details?id=your.package.id&referrer=referrer-value
API
// Callback style
cordova.plugins.referrer.get(success, error);
// Promise style
let promise = cordova.plugins.referrer.get();
Example
// Callback style
cordova.plugins.referrer.get((referrer) => {
console.log(referrer);
}, (error) => {
console.error(error);
});
// Promise style
cordova.plugins.referrer.get().then((referrer) => {
console.log(referrer);
}).catch((error) => {
console.error(error);
});
Testing
To test that the install referrer event is received by the plugin in your emulator:
run adb shell
and then
am broadcast -a com.android.vending.INSTALL_REFERRER \
-n <your.package.id>/by.redstream.referrer.receiver \
--es "referrer" "referrer-value"