react native module to access referrer from JS
MIT License
$ npm install react-native-referrer --save
$ react-native link react-native-referrer
android/app/src/main/java/[...]/MainActivity.java
import com.jdc.reactlibrary.RNReferrerPackage;
to the imports at the top of the filenew RNReferrerPackage()
to the list returned by the getPackages()
methodandroid/settings.gradle
:
include ':react-native-referrer'
project(':react-native-referrer').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-referrer/android')
android/app/build.gradle
:
compile project(':react-native-referrer')
android/app/src/main/AndroidManifest.xml
:
<receiver android:name="com.jdc.reactlibrary.ReferrerReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
import RNReferrer from 'react-native-referrer';
...
const referer = await RNReferrer.getReferrer();