Add JPush on Android
Use the AppKey assigned by NextAppMarket and a pinned JPush release compatible with your app. The fragments below illustrate a current receiver-based integration; consult the installation guide for the exact SDK release and dependency requirements.
1. Add the dependency and AppKey
Configure Maven Central, then add the JPush dependency in your app module. Define jpushVersion as your tested version in the build configuration:
dependencies {
implementation "cn.jiguang.sdk:jpush:${jpushVersion}"
}
android {
defaultConfig {
manifestPlaceholders += [
JPUSH_PKGNAME: applicationId,
JPUSH_APPKEY: "YOUR_NEXTAPPMARKET_JPUSH_APPKEY",
JPUSH_CHANNEL: "developer-default"
]
}
}
Keep JCore and any manufacturer-channel dependencies compatible with the selected JPush release. Review the merged manifest after Gradle applies the library manifests.
2. Register SDK components
Add your JCommonService subclass and JPushMessageReceiver subclass using the component declarations required by that release. A receiver-based declaration uses the cn.jpush.android.intent.RECEIVER_MESSAGE action and your actual application package as its category.
Keep these SDK callback components non-exported where the official integration specifies it. Their role is to carry SDK events into your app, including registration, notifications, and alias/tag results.
3. Initialize when the app is ready
Call SDK initialization after your application's required privacy consent and push-service decision. The following fragment belongs inside that approved initialization path:
import cn.jpush.android.api.JPushInterface;
JPushInterface.setDebugMode(false);
JPushInterface.init(applicationContext);
Follow the consent APIs required by your JCore release as well. Request operating-system notification permission at a point where the customer understands why the app needs it.
4. Capture device registration
Use the SDK registration callback to obtain the Registration ID, then associate it with this installation on your backend. You can also read the current value with JPushInterface.getRegistrationID(context) after registration completes. An empty value means you are not ready to target that device.
Send a notification to that exact ID using the single-device example. Test foreground, background, and notification-open behavior before adding aliases or manufacturer channels.
Verify the release build
Check the AppKey and package, consent path, notification permission, callback registration, notification channel settings, and the optimized release build. Add the provider-required shrinking rules for your pinned SDK rather than disabling optimization for the whole app.
References: Android integration, Android API, and Android debugging.