SDK integration
Expo Integration
Start the integration in less than 5 minutes.
Adding truemetrics via Expo can’t be easier. Find more instructions and a demo app in our github repositories.
- Install dependencies
npm install expo-truemetrics-sdkYou may need to install additional dependencies:
npx expo install expo-build-propertiesnpx expo install expo-locationnpx expo install @react-native-async-storage/async-storagenpm installDeclare Android dependencies in app.json:
"android": {
...
"permissions": [
"ACCESS_COARSE_LOCATION",
"ACCESS_FINE_LOCATION",
"ACTIVITY_RECOGNITION",
"READ_PHONE_STATE"
]
},For reference, SDK uses permissions:
android.permission.FOREGROUND_SERVICE
android.permission.INTERNET
android.permission.HIGH_SAMPLING_RATE_SENSORS
android.permission.ACCESS_COARSE_LOCATION
android.permission.ACCESS_FINE_LOCATION
android.permission.ACCESS_BACKGROUND_LOCATION
android.permission.ACCESS_NETWORK_STATE
android.permission.CHANGE_NETWORK_STATE
android.permission.ACTIVITY_RECOGNITION
android.permission.READ_PHONE_STATE
android.permission.POST_NOTIFICATIONSAdd Maven repo for the SDK to plugins in app.json:
[
"expo-build-properties",
{
"android": {
"extraMavenRepos": [
"https://github.com/TRUE-Metrics-io/truemetrics_android_SDK_p_maven/raw/main"
]
}
}
]Add to plugins in app.json:
[
"expo-location",
{
"locationAlwaysAndWhenInUsePermission": "Allow app to access location."
}
]- Start the app
npx expo startor
npx expo run:androidand boom you are done