Skip to content

Usercentrics/react-native-sdk

Repository files navigation

Usercentrics

Usercentrics

CI/CD npm version follow on Twitter

Already a customer?

In case you wish to report an issue, we provide a dedicated page specifically for this purpose. By accessing the provided link and submitting a ticket our team will address your concerns with the utmost efficiency, ensuring a prompt resolution.

Welcome!

You are now one step closer to make privacy a core feature in your application. We are very happy that you decided to make this a priority. We are here to help you build trust with your users.

The Usercentrics Apps SDK

The Usercentrics Apps SDK is a native Consent Management Platform solution for mobile apps, mobile games & TV applications, that enables the collection, documentation, and management of your user's privacy choices, in order to ensure legal compliance for legal regulations around the world.

Usercentrics UI

πŸ“‹ Requirements

Mobile Platforms

  • Android 5.0 (API 21) or higher
  • iOS 11 or higher

Development Environment

  • Node.js 18.0+ (LTS recommended)
  • npm 9.0+ or Yarn 1.22+
  • TypeScript 5.1+
  • React 18.2+
  • React Native 0.74.3+ (with Fabric support)

Android Development

  • Java 17+ (OpenJDK or Oracle JDK)
  • Android SDK with API 33+ platforms
  • Android NDK 25+
  • Gradle 8.2+
  • Kotlin 1.9.22+
  • Android Gradle Plugin 8.2+

iOS Development (macOS only)

  • Xcode 15.0+ with iOS SDK
  • CocoaPods 1.12+
  • iOS Simulators (recommended)

Optional but Recommended

  • Watchman (for better file watching)
  • Git (for version control)
  • SDKMan (for Java version management)

Get started!

In order to use and test the SDK, you will need a Usercentrics Account. Get started with a free trial.

Integration

Continue to our documentation for a step by step integration guide.

Example

See the example directory for a complete sample app using Usercentrics.

Quick Start

πŸš€ Automated Setup (Recommended)

The easiest way to get started is using our automated setup script:

# Check your development environment
npm run check-requirements

# Automatically install missing dependencies
npm run auto-setup

# Verify everything is ready
npm run check-requirements

πŸ“± Running the Sample Project

Option 1: Using Helper Scripts

# Install all dependencies
npm run install-dependencies

# Run Android app
npm run run-android

# Run iOS app (macOS only)
npm run ios

Option 2: Manual Setup

  • From root folder:
    npm install --legacy-peer-deps
  • From example folder:
    npm install --legacy-peer-deps

iOS (macOS only)

From example folder:

npx pod-install
npx react-native run-ios

Android

Make sure you have Android SDK configured, then from example folder:

npx react-native run-android

πŸ› οΈ Development Scripts

Script Description
npm run auto-setup πŸ€– Automatically install all required dependencies
npm run check-requirements πŸ” Check development environment requirements
npm run clean-all-caches 🧹 Clean all project and system caches
npm run install-dependencies πŸ“¦ Install dependencies in root and example folders
npm run run-android πŸ€– Kill conflicting ports and run Android app

πŸ”§ Troubleshooting

If you encounter issues:

  1. Check Requirements: npm run check-requirements
  2. Clean & Reinstall: npm run clean-all-caches && npm run install-dependencies
  3. Auto Setup: npm run auto-setup (installs missing tools)
  4. Manual Setup: Follow the detailed error messages from check-requirements

πŸ“‹ Environment Setup

The project includes intelligent scripts that will:

  • βœ… Detect your operating system (macOS/Linux)
  • βœ… Check for required tools and versions
  • βœ… Install missing dependencies automatically
  • βœ… Configure environment variables
  • βœ… Apply necessary patches
  • βœ… Verify the setup works correctly

Consent Mediation

You can enable and run the Consent Mediation example in this example by following the documentation.

Maintainers