com.dengage.cordova.example
v1.0.0
Published
A sample Apache Cordova application that responds to the deviceready event.
Readme
Dengage Cordova Example App
This is a sample Cordova application demonstrating the usage of the Dengage Cordova SDK. The app follows the same structure and functionality as the React Native Dengage SDK example.
Features
The app includes the following screens and functionality:
- Home Screen - Main navigation menu
- Ask Notifications - Request push notification permissions
- Device Info - Display device information, integration key, device ID, contact key, token, SDK version, etc.
- Change Contact Key - Set and update contact key and user permission
- Inbox Messages - View, delete, and mark inbox messages as clicked
- In App Message - Configure in-app messages with device info and navigation
- Real Time In App Message - Configure and show real-time in-app messages with filters
- Real Time In App Filters - Access event history and cart management
- Geofence - Request location permissions for geofencing
- InApp Inline - Display inline in-app messages
- App Story - Display app stories
- Event History - Send custom events based on SDK parameters
- Cart - Manage shopping cart items
Setup Instructions
Prerequisites
- Node.js and npm installed
- Cordova CLI installed (
npm install -g cordova) - Android Studio (for Android development)
- Xcode (for iOS development)
Installation
- Navigate to the project directory:
cd dengage-cordova-example- The plugin should already be installed. If not, install it:
cordova plugin add ../dengage-cordova-sdkConfiguration
Android Configuration
- Open
platforms/android/app/src/main/java/com/dengage/cordova/example/MainApplication.java - Replace
YOUR_FIREBASE_INTEGRATION_KEY_HEREwith your actual Firebase Integration Key - (Optional) Replace the Huawei Integration Key if you're using Huawei services
iOS Configuration
- Open
platforms/ios/DengageCordovaExample/AppDelegate.m - Replace
YOUR_IOS_INTEGRATION_KEY_HEREwith your actual iOS Integration Key - Update the
appGroupsKeyif you're using App Groups for notification extensions
Building and Running
Android
cordova build android
cordova run androidiOS
cd platforms/ios
pod install
cd ../..
cordova build ios
cordova run iosProject Structure
dengage-cordova-example/
├── www/
│ ├── index.html # Main HTML file with all screens
│ ├── css/
│ │ └── index.css # Styles matching React Native appearance
│ └── js/
│ ├── index.js # Main entry point
│ ├── navigation.js # Navigation logic
│ ├── dengage-init.js # Dengage SDK initialization
│ └── screens/ # Screen-specific JavaScript files
│ ├── home.js
│ ├── device-info.js
│ ├── contact-key.js
│ ├── inbox-messages.js
│ ├── in-app-message.js
│ ├── rt-in-app-message.js
│ ├── geofence.js
│ ├── in-app-inline.js
│ ├── app-story.js
│ ├── event-history.js
│ └── cart.js
├── platforms/
│ ├── android/
│ │ └── app/src/main/java/com/dengage/cordova/example/
│ │ └── MainApplication.java # Android initialization
│ └── ios/
│ └── DengageCordovaExample/
│ ├── AppDelegate.h # iOS AppDelegate header
│ └── AppDelegate.m # iOS initialization
└── config.xmlInitialization
The Dengage SDK is initialized in platform-specific files:
- Android:
MainApplication.java- Initializes Dengage in theonCreate()method - iOS:
AppDelegate.m- Initializes Dengage indidFinishLaunchingWithOptions:
Both follow the same pattern as the React Native SDK example, with similar configuration options:
- Integration keys
- Logging enabled
- Geofence enabled
- Development status
- Notification permissions
Notes
- The app uses the same Dengage Cordova plugin as the main SDK
- All screens and functionality mirror the React Native example app
- In-app inline views and app stories require native view integration (placeholders are provided)
- Make sure to add your integration keys before building the app
License
Apache License 2.0
