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-sdk
You may need to install additional dependencies:
npx expo install expo-build-properties
npx expo install expo-location
npx expo install @react-native-async-storage/async-storage
Declare 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_NOTIFICATIONS
Add 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
or
and boom you are done