npm install https://github.com/dbasedow/react-native-adjust-sdk.git --save
rnpm link
- open your project's MainActivity.java and add ReactNativeAdjustSdk to the list in the getPackages method:
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(), new ReactNativeAdjustSdk());
}
- add permission to your apps manifest
<uses-permission android:name="android.permission.INTERNET" />
- add INSTALL_REFERRER receiver (very important, without it install attributions will not work)
<receiver android:name="com.adjust.sdk.AdjustReferrerReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
If you use proguard check the official docs: https://github.com/adjust/android_sdk
npm install https://github.com/dbasedow/react-native-adjust-sdk.git --save
rnpm link
- go to https://github.com/adjust/ios_sdk/releases and download the most up to date AdjustSdkStatic.framework.zip (the static part is important, otherwise you have to change your Deployment Target from 7 to 8)
- open your project in XCode
- unzip the framework and open in Finder
- drag AdjustSdk.framework into your XCode project
Add this to your JavaScript code:
import {Adjust, AdjustEnvironmentSandbox} from 'ReactNativeAdjustSdk';
Adjust.init({appToken: 'YOURAPPTOKEN', environment: AdjustEnvironmentSandbox});
Adjust.trackEvent({token: 'EVENTTOKEN'});
The earlier you put it in the code the better. Before the initialization no events/installs are sent to Adjust.
Important: You have to switch from AdjustEnvironmentSandbox to AdjustEnvironmentProduction when releasing your app to production (the log output will remind you).