react-native-auryc v1.0.0
react-native-auryc
iOS
Go to ./ios folder in your react native project and do the followings
1.1 Add Auryc to your podfile
pod 'Auryc'
1.2 Run the following commands
pod install pod update
Go to the root level and add the Auryc bridge to your project
npm install react-native-auryc --save react-native link react-native-auryc
Call the following method when your app starts (when your root component loads):
import Auryc from 'react-native-auryc';
componentDidMount () {
Auryc.initialize(YOUR_SITE_TOKEN, YOUR_SITE_ID);
}
- (Optional) Call the available APIs. Please refer to your portal instructions for the complete list of APIs.
Auryc.identify('abc@example.com')
Auryc.addUserProperties({'company': 'Example Inc'});
...
Android
Go to ./android folder in your react native project and add Auryc library
1.1 In the project level, build.gradle, add Auryc’s maven repository.
allprojects { repositories { ... maven { url "http://maven.auryc.com" } ... } }
1.2 In the module level, build.gradle, define minimum SDK version to 18 and include the packaging options.
android{ ... defaultConfig { ... minSdkVersion 18 multiDexEnabled false ... } packagingOptions { pickFirst 'META-INF/*' ... } }
Then, add the Auryc SDK dependency.
dependencies { compile 'com.auryc:android-sdk:1.1.0' }
1.3 In your res/values/strings.xml, add the token and site_id.
<string name="auryc_token">YOUR_SITE_TOKEN</string> <string name="auryc_site_id">YOUR_SITE_ID</string>
Add the Auryc package to your project
npm install react-native-auryc --save
react-native link react-native-auryc
Open MainApplication.java and change
new RNAurycPackage()
tonew RNAurycPackage(this.getApplication())
Call the following method when your app starts (when your root component loads):
import Auryc from 'react-native-auryc';
componentDidMount () {
Auryc.initialize(YOUR_SITE_TOKEN, YOUR_SITE_ID);
}
- (Optional) Call the available APIs. Please refer to your portal instructions for the complete list of APIs.
Auryc.identify('abc@example.com')
Auryc.addUserProperties({'company': 'Example Inc'});
...
Other notes
Android integration
Use gradle version 4+
React-Native uses Android SDK version 23 which might introduce conflicts when newer version of SDK is used in your project. Consider adding the following block to build.gradle to resolve this.
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
}
}
}
}
iOS
If you run into issues regarding
Print: Entry, “:CFBundleIdentifier”, Does Not Exist
follow the answers here: https://stackoverflow.com/a/41854111
6 years ago