Code Monkey home page Code Monkey logo

acoustic-mobile-push-cordova's Introduction

Acoustic Campaign - Cordova Plugin

Campaign plugin has been published to NPM for Cordova apps. Add the plugin with 'npm' to start configuring basic or advanced mobile app messaging features using an unified configuration file called 'CampaignConfig.json' for both iOS and Android apps.

๐Ÿ“˜ Note:

Beta build plugin ends with '' in the name of the package.

๐Ÿšง Warning:

To transmit sensitive information, encrypt the inbox, in-app, and mobile app messages data before sending it and decrypt the data in memory on the device.

Install Acoustic Campaign Cordova plug-in

  1. Add cordova-acoustic-mobile-push from the project.
npm i cordova-acoustic-mobile-push
  1. Edit App.js to include the following two lines after the existing import statements:
import { NativeModules } from 'react-native';
const { RNAcousticMobilePush } = NativeModules;
RNAcousticMobilePush.requestPushPermission();

Alternatively, you can import the SDK into the component you need.

Update CampaignConfig.json

After the plugin is installed, CampaignConfig.json file will be created if not found on the root of the project. Example screenshot of the file and the json properties:

For production Campaign SDKs, set "useRelease" to true, false uses beta build. Note: It's recommended to set the property to "false" during testing phase.

  "useRelease": true,

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 CampaignConfig.json file in 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 node.js command from project's folder to automatically apply all updates in the json file
node node_modules/cordova-acoustic-mobile-push/scripts/installPlugins.js
  1. Build Android application in cordova
cordova build android
  1. Launch Android app.
cordova run android

Set up your iOS project

๐Ÿ“˜ Note:

The iOS Simulator is unable to handle push messages.

  1. For 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 project 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 Location Updates checkbox.
  5. Edit CampaignConfig.json file in 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 node.js command from project's folder to automatically apply all updates in the json file
node node_modules/cordova-acoustic-mobile-push/scripts/installPlugins.js
  1. Build iOS application in cordova
cordova build ios
  1. Launch Android app.
cordova run ios

Optional: Integrating the iOS notification service

The iOS notification service requires separate provisioning. This plug-in is required if you need to access push received events, dynamic action categories, and media attachments.

  1. Edit CampaignConfig.json file and set to true to cordova-acoustic-mobile-push-plugin-ios-notification-service
"cordova-acoustic-mobile-push-plugin-ios-notification-service": true,
  1. Run node.js command from project's folder to automatically apply all updates in the json file
node node_modules/cordova-acoustic-mobile-push/scripts/installPlugins.js
  1. Build iOS application in cordova which will also update cocoapod depedencies.
cordova build ios
  1. Add a new Notification Service Extension target:
    a. In your XCode project, go to the File menu and select New > Target. A dialog box opens.
    b. In the dialog box, select iOS at the top and then select Notification Service Extension.
    c. Select Next, enter the extension name NewAppNotificationService, and choose **Objective-C **as
    Language.
    d. Click Finish. If a dialog box opens, select Activate. The new target is added to the project. Xcode created a new folder with files in it.
    e. Change the new target bundle identifier prefix and use .notification.
    f. Verify that the new target has the same iOS version as the application target. SDK minimum supported version is 13.0.
    g. Add the MceConfig.json file to the Notification Service target. Open the file and check the notification service target membership in the Target Membership of the File Inspector in the Xcode pane.
    h. Add -ObjC to the Other Linker Flags build options for the Notification Service.
    d. Add App Group capability to both your notification service extension and Application target. Be sure to use the same app group as the main application.
    e. Add the Keychain Sharing capability to both your notification service extension and Application target. Be sure to use the same value as the main application.
    f. Replace the contents of NotificationService.m and NotificationService.h with the following code:
// NotificationService.h
#import <UserNotifications/UserNotifications.h>
#import <AcousticMobilePushNotification/AcousticMobilePushNotification.h>

@interface NotificationService : MCENotificationService

@end
// NotificationService.m
#import "NotificationService.h"

@implementation NotificationService

@end

Add other Campaign features

  1. To add other features, update the 'plugins' section in the 'CampaignConfig.json' file. Below is default recommended settings:
 "plugins": {
    "Please note": "<true/false>, for cordova build.  True for release build, false for beta build",
    "useRelease": false,

    "Required Mobile-Push plugins": "<true/false>, enable or disable plugin",
    "cordova-acoustic-mobile-push": true,
    "cordova-acoustic-mobile-push-plugin-ios-notification-service": true,
    "cordova-acoustic-mobile-push-plugin-inapp": true,
    "cordova-acoustic-mobile-push-plugin-inbox": true,

    "Optional Mobile-Push plugins": "<true/false>, enable or disable plugin",
    "cordova-acoustic-mobile-push-plugin-action-menu": true,
    "cordova-acoustic-mobile-push-plugin-beacon": true,
    "cordova-acoustic-mobile-push-plugin-calendar": true,
    "cordova-acoustic-mobile-push-plugin-dial": true,
    "cordova-acoustic-mobile-push-plugin-displayweb": true,
    "cordova-acoustic-mobile-push-plugin-geofence": true,
    "cordova-acoustic-mobile-push-plugin-location": true,
    "cordova-acoustic-mobile-push-plugin-passbook": true,
    "cordova-acoustic-mobile-push-plugin-snooze": true
  },
  1. Run node.js command to automatically install from project folder
node node_modules/react-native-acoustic-mobile-push/postinstall.js ./

Building the sample app

Instructions

acoustic-mobile-push-cordova's People

Contributors

experienceanalyticssdk avatar wcasmpp avatar ohernandezibm avatar jbuchman avatar metova-joe avatar

Watchers

Morgan Catlin avatar James Cloos avatar Brandon Cox avatar Ben Hoyt avatar Harsh Agarwal avatar Dheeraj Khokhar avatar Justin Pulliam avatar Kevin Skip Rollins avatar

Forkers

edaviok1301

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.