Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Smartphones today Nowadays smartphones are increasingly considered more and more a key part in of any digital solutionssolution. Increased Their increased computing capabilities and faster internet connections allow for capacities and the higher speed of Internet connections enable a new horizon of connected appsapplications. Some IoT applications today use smartphones as gateways, but it is also normal to use the smartphone as a notification and awareness tool in some cases where promptness speed is key.

That is why we have developed a new node for the onesait Platform Flow Engine: onesaitplatform-firebase-notification. This node features has integration with Firebase. Firebase is a Google platform from Google that helps developers dealing with manage the backend of their mobile apps backendapplications. Some of the features of the platform features are open to everybody everyone, and that is the case for the Cloud Messaging featureof the cloud messaging function.

...

This post showcases article shows an example of native notifications to for Android apps applications using the onesait Platform Flow Engine. The guide will highlight the process needed required to perform carry out the example using the onesait Platform modules, whereas while the Firebase-specific task will only be just mentioned but not explained in detail, please . Please contact us for extra info additional information on how to integrate your mobile app within the Firebase platform.

For this example, we have built a custom Android application (app) with a basic layout design and functionality:Image Removed

...

This app has native integration with Firebase, allowing which allows it to be connected to Firebase and receive native notifications (to know learn more about the integration with Firebase integration , follow this this link).

The app behavior looks like thisbehavior of the application is as follows:

  1. First,

...

  1. once the app

...

  1. is installed,

...

  1. it connects

...

  1. to Firebase and is

...

  1. given a Device Token. This token is unique

...

  1. to the Android device

...

  1. , although it

...

  1. can be updated

...

  1. later. It is advisable to monitor these changes using the callback

...

  1. inside the onNewToken method of your class, which

...

  1. extends FirebaseMessagingService.

...

  1. Every time a new token is granted, or when the user clicks

...

  1. the REGISTER DEVICE TOKEN button, the

...

  1. given token is

...

  1. sent to the onesait Platform. These token keys are stored in the NativeNotifKeys ontology, which looks like this (

...

  1. For this example

...

  1. , the application will be a messaging application, and the user will be the IMEI code

...

  1. of the host smartphone):

...

  1. Image Modified

  2. To perform step 2, the NativeNotifKeys ontology

...

  1. must be created (it already

...

  1. exists in the demo environment), and an API endpoint

...

  1. will be created in the environment. This API will publish this ontology

...

  1. via a URL, with INSERT capabilities. For this example, this is

...

  1. what the API definition looks like:

...

  1. Image Added

  2. Now the app, which already has a valid Firebase token

...

  1. , has replicated this

...

  1. information in the onesait Platform, allowing developers to

...

  1. take advantage of this data and send notifications to these devices. But

...

  1. you still have to enable a way to

...

  1. push messages

...

  1. through the onesait Platform to

...

  1. end devices. That is why

...

  1. you must define this ontology, to record

...

  1. incoming messages:

...

  1. Image Added

  2. After the creation of the ontology

...

  1. ,

...

  1. you have to define the rule to send the messages inserted in the notificationMessage ontology to the end devices.

...

  1. Use the onesait Platform Flow Engine module to perform this operation:

...

  1. Image Added

  2. The first block

...

  1. only inserts notification

...

  1. message in the platform.

...

  1. The second block then uses a onesaitplatform-notification-endpoint node to subscribe to the previous

...

  1. inserts in the notificationMessage ontology. This node will insert the message

...

  1. in the onesaitplatform-firebase-notification node, which

...

  1. handles the Firebase integration for the demo app.

  2. With the flow

...

  1. configured, and before

...

  1. starting to send notifications,

...

  1. let’s explore two different types of messages that we have integrated

...

  1. into the example:

    1. Notification to a single, specific device.

    2. Notification to all devices subscribed to a

...

    1. specific theme (or topic).

  1. To change this behavior, there is a topic field

...

  1. within the notificationMessage ontology. If it is blank ("topic":""), then the firebase-notification node will send this notification to the device corresponding to the user field

...

  1. within the message, using the current Firebase token updated by the app via the NativeNotifKeys API

...

  1. .

...

  1. These are the message, the output of the Flow Engine

...

  1. and how the notification appears on the mobile phone:

 Image Modified Image Removed

...

The notification appears promptly quickly with the title and body we defined that you define in the ontology instance of the ontology. Firebase claims that over 95% of the notifications they send, are delivered within an interval of 250msa 250-milisecond interval.

The last step will be to send notifications to a group of devices subscribed to a certain topictheme. To do so first, that, first you have to go to the app and click on press the SUBSCRIBE TO NEWS button:Image Removed

...

And then change the topic to news inside the Flow Engine news” in the flow engine insertion:

...

For topicTo test the theme-based notifications testing, it is better best to install the example sample app into on more than one phone so you can see the difference. From one phone, the result of this will be the arrival of the notification: Image Removed

...

The time - diagram to understand the full complete flow of actions is this:

...

Now test try it yourself and let us know how it went!

If you have any question questions or requirement requests, please contact us at support@onesaitplatform.com