Installation
Detailed installation instructions for bare React Native and Expo projects.
Requirements#
- • React Native 0.72 or later
- • iOS 13.4+ / Android 6.0+ (API 23+)
- • For Expo: SDK 50+ (Expo Go not supported)
Bare React Native#
Install Packages#
Install the SDK and required peer dependencies:
Attribution + Conversions:
npm install @mobana/react-native-sdk \
@react-native-async-storage/async-storageWith Flows:
npm install @mobana/react-native-sdk \
@react-native-async-storage/async-storage \
react-native-webviewOptional Flow Enhancements:
# Optional packages for additional Flow capabilities
npm install react-native-haptic-feedback \
react-native-permissions \
react-native-in-app-review \
react-native-geolocation-service \
react-native-safe-area-context| Package | Purpose |
|---|---|
react-native-haptic-feedback | Haptic feedback in flows |
react-native-permissions | Permission prompts in flows (notifications, location, ATT) |
react-native-in-app-review | App store review prompts |
react-native-geolocation-service | Location services in flows |
react-native-safe-area-context | Safe area insets (recommended) |
iOS Setup (optional, for flows with permissions)#
Only needed if you use react-native-permissions (flows that request notifications, location, or ATT). Configure permissions in your Podfile. Only include permissions for features your flows actually use. Attribution-only and flows without permission prompts don't need this.
# In ios/Podfile, add before target block:
def node_require(script)
require Pod::Executable.execute_command('node', ['-p',
"require.resolve('#{script}', {paths: [process.argv[1]]})",
__dir__]).strip
end
node_require('react-native-permissions/scripts/setup.rb')
# Only include permissions you actually need:
setup_permissions([
'Notifications', # For notification permission prompts
'AppTrackingTransparency', # For ATT prompts (iOS 14.5+)
'LocationWhenInUse', # For foreground location flows
'LocationAlways', # For background location flows
])Then install pods:
cd ios && pod installYou also need to add usage description strings to Info.plist for each permission your flows request. Apple requires these — without them the app will crash when a permission is requested. Customize the text to describe your app's actual use:
<!-- ios/YourApp/Info.plist — add entries for permissions your flows use -->
<!-- Required for ATT prompts (AppTrackingTransparency) -->
<key>NSUserTrackingUsageDescription</key>
<string>We use this identifier to show you relevant content and measure ad effectiveness.</string>
<!-- Required for foreground location (LocationWhenInUse) -->
<key>NSLocationWhenInUseUsageDescription</key>
<string>We use your location to provide location-relevant features.</string>
<!-- Required for background location (LocationAlways) -->
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>We use your location in the background to provide location-relevant features.</string>Android Setup#
Add permissions to your AndroidManifest.xml. Only include permissions for features your flows actually use.
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- For notification permission prompts (Android 13+) -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<!-- For foreground location flows -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- For background location flows -->
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<!-- ... rest of your manifest -->
</manifest>Expo#
This SDK requires native code. Expo Go is not supported. Use expo-dev-client for development builds.
Install Packages#
Attribution + Conversions:
npx expo install @mobana/react-native-sdk \
@react-native-async-storage/async-storageWith Flows:
npx expo install @mobana/react-native-sdk \
@react-native-async-storage/async-storage \
react-native-webviewOptional Flow Enhancements:
npx expo install react-native-haptic-feedback \
react-native-permissions \
react-native-in-app-review \
react-native-geolocation-service \
react-native-safe-area-contextConfigure Expo#
Add the plugin to your app.json or app.config.js:
Attribution-only (no special permissions):
{
"expo": {
"plugins": ["@mobana/react-native-sdk"]
}
}With Flows (add permissions you need):
If your flows use permission prompts, you must install react-native-permissions (npx expo install react-native-permissions). The Mobana plugin handles the native setup (Podfile, Info.plist, AndroidManifest) automatically, but the package itself is still needed at runtime.
{
"expo": {
"plugins": [
["@mobana/react-native-sdk", {
"permissions": [
"Notifications",
"AppTrackingTransparency",
"LocationWhenInUse",
"LocationAlways"
]
}]
]
}
}| Permission | Use Case |
|---|---|
Notifications | Push notification prompts |
AppTrackingTransparency | ATT prompts (iOS 14.5+) |
LocationWhenInUse | Foreground location |
LocationAlways | Background location |
iOS Usage Description Strings#
The Mobana plugin automatically adds default usage description strings to Info.plist for each permission you enable. However, the defaults are generic — Apple may reject apps with vague ATT strings in particular. Always override them with copy that describes your app's actual use via expo.ios.infoPlist in app.config.js:
{
"expo": {
"ios": {
"infoPlist": {
"NSUserTrackingUsageDescription": "We use this identifier to show you relevant content and measure ad effectiveness.",
"NSLocationWhenInUseUsageDescription": "We use your location to provide location-relevant features.",
"NSLocationAlwaysAndWhenInUseUsageDescription": "We use your location in the background to provide location-relevant features."
}
},
"plugins": [
["@mobana/react-native-sdk", {
"permissions": ["AppTrackingTransparency", "LocationWhenInUse"]
}]
]
}
}Apple reviews NSUserTrackingUsageDescription closely. The plugin default is a reasonable starting point, but always customize it to describe how your specific app uses the identifier.
Plugin defaults
NSUserTrackingUsageDescription(AppTrackingTransparency)"This identifier will be used to measure effectiveness of our campaigns and deliver relevant content to you."
NSLocationWhenInUseUsageDescription(LocationWhenInUse / LocationAlways)"This app needs access to your location."
NSLocationAlwaysAndWhenInUseUsageDescription(LocationAlways)"This app needs access to your location in the background."
Verify Installation#
Quick check that the SDK initializes correctly:
import { Mobana } from '@mobana/react-native-sdk';
Mobana.init({
appId: 'YOUR_APP_ID',
appKey: 'YOUR_APP_KEY',
debug: true, // Enable logging
});
// You should see "Mobana initialized" in your consoleFor complete testing of attribution, conversions, and flows, see the Test Setup Guide.