Overview

Messaging

The Bluefletch Messaging package allows for communicating with the device by displaying notification messages within the drawer or passing messages to device applications. This communication utilizes the MQTT protocol.

The Messaging service will handle connecting to one or many MQTT Broker services. By default, the launcher is configured to connect to the BlueFletch cloud MQTT Service.

Features

During Launcher boot process, Launcher will communicate with the Messaging application to start. Then, it will register the MQTT Brokers, per configuration values.

If enableNotificationsAlwaysOn is true, the MQTT broker will be connected.

Once the user logs into the device, additional connections can be made where enableNotificationsAlwaysOn is false.

By default, the Messaging service will register for the following topics:

  • Device Serial Number

  • User Role

  • Location

  • Groups

Additonal Information on the MQTT Protocol can be found at https://github.com/mqtt/mqtt.github.io/wiki.

Application Details

Package: com.bluefletch.ems.messaging

Configurations

Notifications

Field Description
notifications Array The collection of notification broker objects

Broker Object

Represents the MQTT Broker and related behaviors.

Field Description
brokerId string Unique id that represents the broker settings
url string (required) Represents the URL connection string to the MQTT broker. Should contain protocol, hostname (and port number, if applicable).
urls string (optional) A comma delimited list of URLs that the broker can connect to. This can be used to perform failover processing (e.g. if cannot connect to the first URL, it will attempt the next one on the list) or load balancing (can randomly select a broker to connect to). If specified, the Messaging app will use these for connection instead of the url field. Each URL should contain protocol, hostname (and port number, if applicable).
randomizeUrls boolean If set to true, will randomly select a URL from the list to connect to. If set to false, will use the first one on the list. In both cases, the application will failover to the next URL on the list of URLs. This setting is only applicable if urls field is used.
name string Name to be displayed when showing connection status
enableOrganizationGroup boolean Indicates to use Organization Id part of Topic
useEnhancedMessaging boolean true/ false. If True, when a message is received, the message will be broadcast out, so that other applications can process.
muteNotificationsOnCall boolean true / false (defaults true). If Sound is in use (by phone call), when a message is received, no notification sound will be played.
notificationAcquireWakelocks boolean true/false (defaults true). If true, once a connection is made to the notification service, a CPU Wake lock will be acquired, in an attempt to allow for notifications when the device is asleep.
receiveOfflineMessages boolean true / false (default true). If the device goes offline and reconnects, the device will resubscribe for messages.
mqttUserName string user id to be used for MQTT Broker Service login
mqttPassword string encrypted password to be used for MQTT Broker Service login
enableNotificationsAlwaysOn boolean true or false. If true, will register the device Serial Number with MQTT, and keep connection to MQTT server. Otherwise connections are only done AFTER the user is logged in.
enableHeadsUpNotifications boolean true or false. if Kitkat or above and true, enable heads up display of notification received

Example

"notifications" : [
    {
      "brokerId" : "deviceManager",
      "url": "tcp://ems-notifications-prd.bluefletch.com:1883",
      "name" : "Device",
      "enableOrganizationGroup" : true,
      "useEnhancedMessaging" : true,
      "muteNotificationsOnCall" : true,
      "notificationAcquireWakelocks" : true,
      "receiveOfflineMessages" : true,
      "mqttUserName" : "admin",
      "mqttPassword" :  "V4E0CTsCt2wt8I7kAdcM9w==",
      "enableNotificationsAlwaysOn" : true,
      "enableHeadsUpNotifications" : true
    },{
      "brokerId" : "StoreTest",
      "url": "tcp://brokernode-XX:1883",
      "urls" : "tcp://brokernode-01:1883,tcp://brokernode-02:1883,tcp://brokernode-03:1883",
      "randomizeUrls" : true,
      "name" : "Store",
      "enableOrganizationGroup" : true,
      "useEnhancedMessaging" : true,
      "muteNotificationsOnCall" : true,
      "notificationAcquireWakelocks" : true,
      "receiveOfflineMessages" : true,
      "mqttUserName" : "admin",
      "mqttPassword" :  "V4E0CTsCt2wt8I7kAdcM9w==",
      "enableNotificationsAlwaysOn" : false,
      "enableHeadsUpNotifications" : true
    }
  ],