Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
react-native-play-install-referrer
Advanced tools
Play Install Referrer Library wrapper for React Native
Supported platforms: | |
Current version: | 1.1.8 |
Troubles? | Report an issue |
react-native-play-install-referrer is a simple wrapper around Google's Play Install Referrer Library which offers basic functionality of obtaining Android referrer information from React Native app.
More information about Play Install Referrer API can be found in official Google documentation.
Version of native Play Install Referrer Library which is being used inside of latest react-native-play-install-referrer plugin version is 2.2.
react-native-play-install-referrer plugin is hosted on npm repo and can be added from there.
Yarn:
yarn add react-native-play-install-referrer
npm:
npm install --save react-native-play-install-referrer
In order to obtain install referrer details, call getInstallReferrerInfo static method of PlayInstallReferrer class:
import { PlayInstallReferrer } from 'react-native-play-install-referrer';
PlayInstallReferrer.getInstallReferrerInfo((installReferrerInfo, error) => {
if (!error) {
console.log("Install referrer = " + installReferrerInfo.installReferrer);
console.log("Referrer click timestamp seconds = " + installReferrerInfo.referrerClickTimestampSeconds);
console.log("Install begin timestamp seconds = " + installReferrerInfo.installBeginTimestampSeconds);
console.log("Referrer click timestamp server seconds = " + installReferrerInfo.referrerClickTimestampServerSeconds);
console.log("Install begin timestamp server seconds = " + installReferrerInfo.installBeginTimestampServerSeconds);
console.log("Install version = " + installReferrerInfo.installVersion);
console.log("Google Play instant = " + installReferrerInfo.googlePlayInstant);
} else {
console.log("Failed to get install referrer info!");
console.log("Response code: " + error.responseCode);
console.log("Message: " + error.message);
}
});
If successfully obtained, map with content of install referrer information will be delivered into callback method as first parameter. From that map, you can get following install referrer details:
You should first check if second parameter in the callback - error is null or not. If not, for some reason reading of install referrer details failed. In case no error is reported, install referrer information should be delivered into the first map parameter of the callback method.
In case error is reported, you can get following information about the error:
OK
will never be reported in this property, since it's a success status code). Note: Error code field is not always present in error map - only if error created when one of the error codes from native Install Referrer Library is received; otherwise this field will be undefined.Important thing to notice is that in order to work properly, Play Install Referrer Library requires following permission to be added to your app's AndroidManifest.xml
:
<uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE"/>
Play Install Referrer Library is added to react-native-play-install-referrer plugin as an Gradle dependency and it will automatically make sure that manifest file ends up with above mentioned permission added to it upon building your app.
You can find example apps using react-native-play-install-referrer plugin inside example-app-js and example-app-ts folders of this repository. In case you want to run the app (with re-adding plugin), you can run this command inside app folder:
yarn remove react-native-play-install-referrer && yarn add ../ && npx react-native run-android
List of tasks to be done in this repository can be found in here.
Version 1.1.8 [19th January 2022]
FAQs
Play Install Referrer Library wrapper for React Native
We found that react-native-play-install-referrer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.