Skip to content
react native module to access referrer from JS
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
android chore: make gradle compliant with RN 0.56 and update version Sep 5, 2018
.badge.json docs: add npm badges on readme Jan 12, 2019
.gitattributes first commit Oct 2, 2017
.gitignore docs: add npm badges on readme Jan 12, 2019
.prettierrc docs: add npm badges on readme Jan 12, 2019
LICENSE.md docs: add MIT licence Jan 12, 2019
README.md
index.js first commit Oct 2, 2017
package.json chore: bump version Jan 12, 2019
yarn.lock docs: add npm badges on readme Jan 12, 2019

README.md

react-native-referrer

npm version npm license npm download npm download

Getting started

$ npm install react-native-referrer --save

Mostly automatic installation

$ react-native link react-native-referrer

Manual installation

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.jdc.reactlibrary.RNReferrerPackage; to the imports at the top of the file
  • Add new RNReferrerPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-referrer'
    project(':react-native-referrer').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-referrer/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
    compile project(':react-native-referrer')
    
  3. Insert the following lines inside the application block in 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>

Usage

import RNReferrer from 'react-native-referrer';

...
const referer = await RNReferrer.getReferrer();
You can’t perform that action at this time.