Implementing the Initialization and Reception Processes

In order to use the push notification feature in your mobile app, implement the initialization process of the feature and the message reception process by adding code like that shown in the push notification tutorial.

  • Initialization process

    Initialize the push notification feature, for example, when the mobile app starts.

    The initialization process needs to initialize the push notification feature of Kii Cloud (install a device) in addition to initializing FCM or JPush. For more information, see Installing a Device.

  • Reception process

    Kii Cloud provides its own push notification feature on the basis of push notification technologies such as FCM and JPush.

    The onMessageReceived() method of the FirebaseMessagingService class receives FCM push notifications and the onReceive() method of the BroadcastReceiver class receives JPush push notifications. For the implementation, see the push notification tutorials.

    Then, the payload (JSON string) of the received push message can be interpreted according to the specification of the push notification feature of Kii Cloud. The reception method in the tutorial uses switch - case statements to branch the process by the three notification types: PUSH_TO_APP, PUSH_TO_USER, and DIRECT_PUSH. The subsequent processes should be implemented as described in Push to App Notification, Push to User Notification, and Direct Push Notification.

    For the procedures to display a message in the status bar, see Push Notification Implementation Tips.