Push Notification with JPush

To use the JPush-based push notification, you need to make some JPush-related configuration and prepare your build environment besides configuring Kii Cloud.

See Using JPush for the overview of JPush.

Setting up

Here we will present steps for setting up the push notification and preparing your Android Studio project.

This page only provides the steps. You can find the detailed instruction in our tutorial (just click the links to read them). Go to Modification for Thing-IF after you complete the tutorial.

Registering your mobile app

You need to register your mobile app in the JPush Console and get the AppKey and Master Secret. Once you get them, you need to register them on the Kii Cloud developer portal.

  1. Create a JPush Project

    Create a new project for your application in the JPush Console and get your JPush App Key and API Master Secret.

  2. Configure Kii Cloud

    Register the AppKey and Master Secret in the Kii Cloud developer portal.

Configuring your project

Next, you need to set up your build environment.

  1. Configure the Build Environment

    Integrate the JPush Android SDK in your development project as a library.

    The tutorial assumes that you use Android Studio. If you use another development environment, you need to make the same configuration.

  2. Configure the Manifest File

    Update the Manifest file to add the necessary privileges and the reception handler.

Implementing and testing your program

Implement the initialization logic and handler for push notification to the mobile app and try to send a push notification.

  1. Implement Your Application

    Add the initialization logic and handler for push notification to the mobile app.

  2. Send Test Messages

    Try to send a push notification from the developer portal.

Modification for Thing-IF

Once you are done with the tutorial, we will remove lines that are unnecessary for mobile apps with the Thing-IF SDK. Replace the lines for device installation that use the Kii Cloud SDK API with those that use the Thing-IF SDK API. This is because the method for device installation is different between the two SDKs.

From the implementation of MainActivity, delete the part that calls KiiUser.pushInstallation, the related callback methods, and the line above (the one declaring the development).

Leave the sample code as it is for now. We will insert the API call for Thing-IF later. See Installing a device in the Initializing and Onboarding topic for more information.

Note that the API to initialize push notification used in the Android (JPush) Push Notification Tutorial is non-blocking while the API of the Thing-IF SDK to be inserted later is blocking. You need to call the blocking API from a worker thread. See Implementation Guidelines for more information about asynchronous processing.