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.
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.
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.
Create a new project for your application in the JPush Console and get your JPush App Key and API Master Secret.
Register the AppKey and Master Secret in the Kii Cloud developer portal.
Next, you need to set up your 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.
Update the Manifest file to add the necessary privileges and the reception handler.
Implement the initialization logic and handler for push notification to the mobile app and try to send a push notification.
Add the initialization logic and handler for push notification to the mobile app.
Try to send a push notification from the developer portal.
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
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.