This repository contains a sample Expo React Native app showcasing how to integrate WebEngage with native support via Expo prebuild.
- Integrates WebEngage SDK with a React Native (Expo) app
- Supports Firebase Cloud Messaging (FCM) push notifications
- Uses
expo prebuildto generate native iOS/Android folders - Easy configuration using
app.json - Example setup for Android push via
google-services.json
- Node.js ≥ 14
- npm or yarn
- Expo CLI (
npm install -g expo-cli) - WebEngage license key
- Firebase project with
google-services.json - macOS with Xcode (for iOS testing)
- Run
expo prebuildto generate the nativeandroid/andios/folders. - Replace the
google-services.jsonfile inandroid/app/with your actual Firebase config file. - Update the package name in
app.jsonunderexpo.android.packageto match the one in yourgoogle-services.json. - Update
app.jsonwith your WebEngagelicenseCodeandenvironment(DEVorPROD). - Run the app using the following commands:
npm run android– to run the app on Android.npm run ios– to run the app on iOS (macOS only).
- The
android/andios/folders will include all necessary native code, andgoogle-services.jsonwill be placed in the right directory automatically.
{
"expo": {
"name": "expoTest",
"slug": "expoTest",
"android": {
"package": "com.yourcompany.app"
},
"plugins": [
[
"./node_modules/webengage-expo/src/withWebEngage.js",
{
"push": {
"mode": "development"
},
"ios": {
"WEGLicenseCode": "~1341056cd",
"WEGLogLevel": "VERBOSE",
"WEGEnvironment": "DEFAULT",
"WEGAutoRegister": true
},
"android": {
"manifest": {
"com.webengage.sdk.android.environment": "us",
"com.webengage.sdk.android.key": "~1341056cd",
"com.webengage.sdk.android.debug": true
}
}
}
],
[
"webengage-expo-push",
{
"mode": "development"
}
]
]
}
}