SDK integration
React Native Integration
Start the integration in less than 5 minutes.
You can find the detailed inscruption here
Prerequisites
- Node.js (v18 or later)
- Java Development Kit (JDK) 17
- Android Studio
- Android SDK Platform Tools
- React Native CLI
Setup
- Clone the repository:
- Install dependencies:
- If needed, configure Android SDK path in your environment:
- Run the application:
or
Usage
SDK Initialization
- Launch the app and enter your Truemetrics SDK API key in the input field
Recording Management
Once initialized, you can:
- Start recording by tapping “Start recording”
- Stop recording by tapping “Stop recording”
- View current SDK state at the top of the screen
- Monitor any SDK errors that appear below the state
Metadata Logging
When the SDK is initialized:
- Tap “Log metadata”
- Enter key and value in the respective fields
- Tap “Log metadata” to save
Permissions
The app will request the following permissions as needed:
- Phone state
- Activity recognition
- Location (both foreground and background)
Project Structure
App.tsx
: Main application componentHomeScreen
: Primary screen for SDK controlLogMetadataScreen
: Screen for metadata management- Android native module integration for Truemetrics SDK
SDK States
The application handles the following SDK states:
UNINITIALIZED
: Uninitialized stateINITIALIZED
: SDK is ready for useRECORDING_IN_PROGRESS
: Currently recordingRECORDING_STOPPED
: Recording has been stopped
Error Handling
- SDK errors are displayed in red below the status
- Errors include both error codes and messages from the SDK
Dependencies
- React Native
- @react-navigation/native
- @react-navigation/native-stack
- Truemetrics SDK for Android