You can use the sample app in the Cordova plug-in to show examples of how to customize and test your mobile app messages.
To use the sample app in the Cordova plug-in:
- Download the Cordova package at https://github.com/ibm-mobile-push/cordova/releases/latest and change to the samples/Sample folder.
- Rename the Android app package id
1. Modify applications/samples/Sample/config.xml
a. change widget node’s android-packageName value to your preferred Android package name
b. change the widget node’s CFBundleIdentifier to your preferred iOS Bundle Identifier
2. Modify package.json “name” value to match the preferred Android package name
3. If using FCM copy the google-services.json file to the applications/samples/sample directory
4. Execute “cordova prepare”
5. Execute “cordova platform add android”
6. Execute “cordova platform add ios” - Add the Cordova plug-in by adding the following information:
cordova plugin add plugins/co.acoustic.mobile.push.plugin --variable ANDROID_APPKEY=
--variable IOS_DEV_APPKEY= --variable IOS_PROD_APPKEY= --variable SERVER_URL=//sdk.ibm.xtify.com/3.0 --variable LOGLEVEL=verbose --variable AUTO_INITIALIZE_LOCATION=false --variable CHANNEL_NAME="Your Channel Name" --variable CHANNEL_DESCRIPTION="Your Channel Description" --variable CHANNEL_ID="YourChannelId" --force cordova plugin add <path to downloaded directory>/plugins/co.acoustic.mobile.push.plugin.calendar cordova plugin add <path to downloaded directory>/plugins/co.acoustic.mobile.push.plugin.snooze cordova plugin add <path to downloaded directory>/plugins/co.acoustic.mobile.push.plugin.displayweb cordova plugin add <path to downloaded directory>/plugins/co.acoustic.mobile.push.plugin.inbox cordova plugin add <path to downloaded directory>/plugins/co.acoustic.mobile.push.plugin.inapp cordova plugin add <path to downloaded directory>/plugins/co.acoustic.mobile.push.plugin.geofence cordova plugin add <path to downloaded directory>/plugins/co.acoustic.mobile.push.plugin.location --variable SYNC_RADIUS=10000 --variable SYNC_INTERVAL=60 cordova plugin add <path to downloaded directory>/plugins/co.acoustic.mobile.push.plugin.beacon --variable UUID=<UUID> cordova prepare For the SERVER_URL for your pod, go here.
- For iOS, perform these steps:
- In Xcode, go to Project > Target > Capabilities and enable Push Notifications.
- Open the Xcodeproj file in platforms/ios/<yourprojectname>.xcodeproj. In the iOS sample app, you must change the app ID of the sample app to match the certificate’s app ID after you open it in Xcode.
Remember: If you do not set your team and provisioning profile, the app will not have permission to get the APNs deviceToken.
- For Android, set the ANDROID_HOME variable. For example, export ANDROID_HOME=/Applications/android.
- Run the emulator for your sample apps.
- Build and run your Android and iOS apps.
Need more help? Check out all of our available tutorials for mobile app messaging here.