1.0.5 • Published 4 years ago
react-native-mobience v1.0.5
React Native Mobience SDK plugin for Android
MobienceSDK is a tool for gathering users phone data and events tracking.
Overview
Plugin installation
yarn add react-native-mobience
or
npm install react-native-mobience --save
React Native >= 0.60
Starting from React Native 0.60, autolinking makes the installation process simpler
React Native <= 0.59
Mostly automatic installation:
react-native link react-native-mobience
Manual installation:
- Add to:
android/settings.gradle
include ':react-native-mobience'
project(':react-native-mobience').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mobience/android')
- Add to:
android/app/build.gradle
dependencies {
implementation project(':react-native-mobience')
}
- Add the MobiencePackage class to your list of exported packages into:
android/app/src/main/.../MainApplication.java
...
import pl.spicymobile.reactmobience.MobiencePackage;
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new MobiencePackage()
);
}
SDK Initialization
Initialize SDK first
if (Platform.OS === 'android') {
Mobience.init("V0K6jhiIfem6CRWHYZ59Nmj3oFBBKbJsnSsWfR2JNq7ktblOUXwbJoBQTpWnw2uSwW76gpiu2kun50jweTY69B",
{},
(initSuccess) => {
console.log(initSuccess)
},
(initError) => {
console.log(initError)
})
}
Start gather data
Mobience.startSDK((result) => {
console.log(result)
}, (errorResult) => {
console.log(errorResult)
})