Available upon request
Please contact your Customer Success Manager for access and the Leanplum team will enable it for you.
Note that MiPush integration requires using Leanplum Android SDK version 5.6.2 and above.
Create a Xiaomi developer account from the Xiaomi Console Website.
You can now proceed with the steps to integrate leanplum-mipush library into your Android application:
- Add a library dependency:
All Leanplum dependencies used (leanplum-core, leanplum-fcm, leanplum-push...) must be set on the same version. We release all of the packages at the same time, so the correct version will always be available.
We migrated our packages from jCenter to Maven Central. Ensure you have included mavenCentral() in your repositories in build.gradle file, if you have not already.
- Add the following permissions to your android manifest file and replace YOUR_PACKAGE_NAME with your package name:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.GET_TASKS" /> <permission android:name="YOUR_PACKAGE_NAME.permission.MIPUSH_RECEIVE" android:protectionLevel="signature" /> <uses-permission android:name="YOUR_PACKAGE_NAME.permission.MIPUSH_RECEIVE" /> <uses-permission android:name="android.permission.VIBRATE" />
These permissions are requested by the MiPush library. This is explained in section 2.1 from their documentation.
The other manifest configuration is implemented by the leanplum-mipush library.
- Setup your application to use MiPush.
LeanplumMiPushHandler.setApplicationwhere first argument is Xiaomi App ID and second is Xiaomi App Key. The keys are available in the MiPush Console for the app created in the MiPush Console steps.
- Add your Xiaomi App Secret to Leanplum. In the Leanplum dashboard, go to App Settings, click Keys & Settings. Go to the Push Notifications tab and enter/paste your key into the Xiaomi App Secret field.
- You've already completed all integration steps. Now in order to send a message through the MiPush service select "Use MiPush" in Advanced Options when setting up a Push Notification campaign. When this option is selected push notifications targeted to users on Xiaomi devices will be automatically sent through Xiaomi proprietary push service MiPush, while all the rest of the devices will be targeted via FCM.