Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

codeborne/mobile-messaging-cordova-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mobile Messaging SDK plugin for Cordova

npm

Mobile Messaging SDK is designed and developed to easily enable push notification channel in your mobile application. In almost no time of implementation you get push notification in your application and access to the features of Infobip IP Messaging Platform. The document describes library integration steps for your Cordova project.

Requirements

  • Cordova 7.0+ (sudo npm install -g cordova)
  • npm (tested with 4.1.2)
  • node (tested with 7.5.0)

For iOS project:

  • Xcode 10
  • Carthage (brew install carthage)
  • Minimum deployment target 9.0

For Android project:

  • Android Studio
  • API Level: 14 (Android 4.0 - Ice Cream Sandwich)

Quick start guide

This guide is designed to get you up and running with Mobile Messaging SDK plugin for Cordova:

  1. Make sure to setup application at Infobip portal, if you haven't already.

  2. Add MobileMessaging plugin to your project, run in terminal:

    $ cordova plugin add com-infobip-plugins-mobilemessaging --save
  3. Configure platforms

    1. iOS: Integrate Notification Service Extension into your app in order to obtain:
      • more accurate processing of messages and delivery stats
      • support of rich notifications on the lock screen
    2. Android: add Firebase Sender ID via plugin variable in config.xml :
    <plugin name="com-infobip-plugins-mobilemessaging" spec="...">
        <variable name="ANDROID_FIREBASE_SENDER_ID" value="Firebase Sender ID" />
    </plugin>
  4. Add code to your project to initialize the library after deviceready event with configuration options and library event listener:

    onDeviceReady: function() {
        ...
        MobileMessaging.init({
                applicationCode: '<your_application_code>',
                geofencingEnabled: '<true/false>',
                ios: {
                    notificationTypes: ['alert', 'badge', 'sound']
                }
            },
            function(error) {
                console.log('Init error: ' + error.description);
            }
        );
    
        MobileMessaging.register('messageReceived', 
            function(message) {
                console.log('Message Received: ' + message.body);
            }
        );
    
        ...
    }

Initialization configuration

MobileMessaging.init({
        applicationCode: <String; Infobip Application Code from the Customer Portal obtained in step 2>,
        ios: {
            notificationTypes: <Array; values: 'alert', 'badge', 'sound'; notification types to indicate how the app should alert user when push message arrives>
        },
        android: { // optional
            notificationIcon: <String; a resource name for a status bar icon (without extension), located in '/platforms/android/app/src/main/res/mipmap'>,
            multipleNotifications: <Boolean; set to 'true' to enable multiple notifications>,
            notificationAccentColor: <String; set to hex color value in format '#RRGGBB' or '#AARRGGBB'>
        },
        geofencingEnabled: <Boolean; set to 'true' to enable geofencing inside the library>, // optional
        messageStorage: <Object; message storage implementation>, // optional
        defaultMessageStorage: <Boolean; set to 'true' to enable default message storage implementation>, // optional
        notificationCategories: [ // optional
           {
               identifier: <String; a unique category string identifier>,
               actions: [
                   {
                       identifier: <String; a unique action identifier>,
                       title: <String; an action title, represents a notification action button label>,
                       foreground: <Boolean; to bring the app to foreground or leave it in background state (or not)>,
                       textInputPlaceholder: <String; custom input field placeholder>,
                       moRequired: <Boolean; to trigger MO message sending (or not)>,
                                               
                       // iOS only
                       authenticationRequired: <Boolean; to require device to be unlocked before performing (or not)>,
                       destructive: <Boolean; to be marked as destructive (or not)>,
                       textInputActionButtonTitle: <String; custom label for a sending button>,
                       
                       // Android only
                       icon:
                        <String; a resource name for a special action icon>
                   }
               ]   
           }
        ],
        privacySettings: { // optional
            carrierInfoSendingDisabled: <Boolean; defines if MM SDK should send carrier information to the server; false by default>,
            systemInfoSendingDisabled: <Boolean; defines if MM SDK should send system information to the server; false by default>,
            userDataPersistingDisabled: <Boolean; defines if MM SDK should persist User Data locally. Persisting user data locally gives you quick access to the data and eliminates a need to implement the persistent storage yourself; false by default>
        }
    },
    function(error) {
        console.log('Init error: ' + error.description);
    }
);

More details on SDK features and FAQ you can find on Wiki


NEXT STEPS: User profile


If you have any questions or suggestions, feel free to send an email to support@infobip.com or create an issue.

About

Mobile Messaging SDK plugin for Cordova

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 50.5%
  • Java 29.8%
  • Swift 13.1%
  • CSS 3.4%
  • HTML 2.6%
  • Shell 0.6%