Build a sample app to evaluate the Campaign Cordova SDK
You can use the sample app provided with our Cordova SDK to customize and test your mobile app messages with minimal effort.
Before you begin
Download the Cordova package and change to the samples/Sample
folder.
Update Config.xml
<widget android-packageName="co.acoustic.mobile.push.samples.android" id="co.acoustic.mobile.push.sample" ios-CFBundleIdentifier="INSERT.BUNDLE.ID.HERE" version="3.9.16"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Sample</name>
Go to applications/samples/Sample/config.xml
and modify the following:
- change the widget node’s
android-packageName
value to your preferred Android package name. - change the widget node’s
CFBundleIdentifier
to your preferred iOS Bundle Identifier.
Set up application
In a terminal window, switch to the project directory and run the installation.
cd applications/samples/Sample
npm install
Set up your Android project
- For Android Campaign SDK version, update
androidVersion
if you need a version which is not the latest. Otherwise leave it blank to get the latest.
"androidVersion": "x.x.x",
- Copy your google-services.json file with your Google-provided FCM credentials to your Android project folder:
platforms/android/app/google-services.json
. - Edit the CampaignConfig.json file in the Android section and fill in the
baseUrl
andappKey
provided by your account team.
"baseUrl": "https://mobile-sdk-lib-XX-Y.brilliantcollector.com",
"appKey": {
"prod": "INSERT APP KEY HERE"
},
- Run the following Node.js command from the project folder to automatically apply all updates in the JSON file.
node node_modules/cordova-acoustic-mobile-push/scripts/installPlugins.js
- Build the Android application in Cordova. This will create an APK file that you can run on your emulator at
applications/samples/Sample/platforms/android/app/build/outputs/apk/debug
.
cordova build android
Set up your iOS project
- For the iOS Campaign SDK version, update
iOSVersion
if you need a version which is not the latest. Otherwise leave it blank to get the latest.
"iOSVersion": "x.x.x",
- Open the iOS workspace file in Xcode.
- Fix up the bundle ID and signing to use a bundle ID and profile with appropriate capabilities.
- Add the Push Notification capability to your project: Go to Signing & Capabilities, Click +Capability , and select Push Notification.
- Turn on the Location Updates background mode to your project: Go to Signing & Capabilities and check the Location Updates checkbox.
- Edit the CampaignConfig.json file in the iOS section and fill in the
baseUrl
andappKey
provided by your account team.
"baseUrl": "https://mobile-sdk-lib-XX-Y.brilliantcollector.com",
"appKey": {
"dev": "INSERT APP KEY HERE",
"prod": "INSERT APP KEY HERE"
},
- Run the following Node.js command from the project folder to automatically apply all updates in the JSON file.
node node_modules/cordova-acoustic-mobile-push/scripts/installPlugins.js
- Build and run the iOS app in Cordova.
cordova build ios
cordova run ios
Updated about 1 month ago