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

  1. 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",
  1. Copy your google-services.json file with your Google-provided FCM credentials to your Android project folder: platforms/android/app/google-services.json.
  2. Edit the CampaignConfig.json file in the Android section and fill in the baseUrl and appKey provided by your account team.
"baseUrl": "https://mobile-sdk-lib-XX-Y.brilliantcollector.com",
"appKey": {
  "prod": "INSERT APP KEY HERE"
},
  1. 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
  1. 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

  1. 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",
  1. Open the iOS workspace file in Xcode.
  2. Fix up the bundle ID and signing to use a bundle ID and profile with appropriate capabilities.
  3. Add the Push Notification capability to your project: Go to Signing & Capabilities, Click +Capability , and select Push Notification.
  4. Turn on the Location Updates background mode to your project: Go to Signing & Capabilities and check the Location Updates checkbox.
  5. Edit the CampaignConfig.json file in the iOS section and fill in the baseUrl and appKey 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"
},
  1. 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
  1. Build the iOS app in Cordova.
cordova build ios
  1. Launch the iOS app.
cordova run ios