1. Add the following xml to your config.xml
in the root directory of your www
folder:
<feature name="AppsFlyerPlugin">
<param name="ios-package" value="AppsFlyerPlugin" />
</feature>
<feature name="AppsFlyerPlugin">
<param name="android-package" value="com.appsflyer.cordova.plugin.AppsFlyerPlugin" />
</feature>
2. For Android, add the following xml to your AndroidManifest.xml
:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
3. Copy appsflyer.js to www/js/plugins
and reference it in index.html
:
<script type="text/javascript" src="js/plugins/appsflyer.js"></script>
4. Download the source files and copy them to your project.
Open in Xcode AppDelegate.m
, add #import "AppsFlyerTracker.h"
and add the following method under application: openURL
:
[[AppsFlyerTracker sharedTracker] handleOpenURL:url sourceApplication:sourceApplication withAnnotation:annotation];
It appears as follows:
-(BOOL) application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
[[AppsFlyerTracker sharedTracker] handleOpenURL:url sourceApplication:sourceApplication withAnnotation:annotation];
return YES;
}
##Demo
This plugin has a examples
folder with demoA
(Angular 1) and demoC
(Cordova) projects bundled with it. To give it a try , clone this repo and from root a.e. cordova-plugin-appsflyer-sdk
execute the following:
For Cordova:
npm run setup_c
npm run demo_c.ra
- runs Androidnpm run demo_c.ba
- builds Androidnpm run demo_c.ri
- runs iOSnpm run demo_c.bi
- builds iOS
For Angular:
npm run setup_a
npm run demo_a.ra
- runs Androidnpm run demo_a.ba
- builds Androidnpm run demo_a.ri
- runs iOSnpm run demo_a.bi
- builds iOS