Initialization
When initializing with JIM.getInstance().init(), use the overload that accepts InitConfig:
JIM.InitConfig initConfig = new JIM.InitConfig.Builder()
.setPushConfig(new PushConfig.Builder().build())
.build();
JIM.getInstance().init(appContext, appKey, initConfig);
- Xiaomi
- Huawei
- HONOR
- OPPO
- vivo
- FCM
- JPush
Add dependencies.
implementation files('libs/XMPlugin.aar')
implementation files('libs/MiPush_SDK_Client_6_0_1-C_3rd.aar')Set the Xiaomi push
appIdandappKeywhen constructingInitConfig.JIM.InitConfig initConfig = new JIM.InitConfig.Builder()
.setPushConfig(new PushConfig.Builder()
.setXmConfig("appId", "appKey")
.build())
.build();ProGuard configuration.
-keep class com.juggle.im.push.** {*;}
Add dependencies.
implementation files('libs/HWPlugin.aar')
implementation 'com.huawei.hms:push:6.10.0.300'Add configuration to
build.gradlein the project root.repositories {
maven { url 'https://developer.huawei.com/repo/' }
}
dependencies {
classpath 'com.huawei.agconnect:agcp:1.9.1.301'
}Add configuration to
build.gradlein theappmodule.plugins {
id 'com.huawei.agconnect'
}Place the Huawei push configuration file
agconnect-services.jsonin theappmodule directory.Set the Huawei push
appIdwhen constructingInitConfig.JIM.InitConfig initConfig = new JIM.InitConfig.Builder()
.setPushConfig(new PushConfig.Builder()
.setHwConfig("appId")
.build())
.build();ProGuard configuration.
-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keep class com.huawei.hianalytics.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
-keep class com.juggle.im.push.** {*;}
Add configuration to
build.gradlein the project root.buildscript {
dependencies {
...
// Add the asplugin configuration. We recommend using the latest version.
classpath 'com.hihonor.mcs:asplugin:2.0.1.300'
// Add the Gradle plugin configuration and select the matching plugin version for your Gradle version
classpath 'com.android.tools.build:gradle:8.0'
}
}Add configuration to
settings.gradlein the project root.pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
// Configure the SDK Maven repository.
maven {
url 'https://developer.hihonor.com/repo'
}
}
}
dependencyResolutionManagement {
...
repositories {
google()
mavenCentral()
// Configure the SDK Maven repository.
maven {
url 'https://developer.hihonor.com/repo'
}
}
}Add configuration to
build.gradlein theappmodule.plugins {
id 'com.hihonor.mcs.asplugin'
}
dependencies {
implementation files('libs/HonorPlugin.aar')
implementation 'com.hihonor.mcs:push:10.0.13.305'
}Place the HONOR push configuration file
mcs-services.jsonin the project root.Copy the signing file to the project's
appdirectory and configure signing inbuild.gradle.android {
signingConfigs {
config {
// Replace xxxx in the following parameters with your actual signing information
keyAlias 'xxxx'
keyPassword 'xxxx'
storeFile file('xxxx.jks')
storePassword 'xxxx'
}
}
buildTypes {
debug {
signingConfig signingConfigs.config
}
release {
signingConfig signingConfigs.config
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}Add configuration to
AndroidManifest.xml.<manifest ...>
<application>
<meta-data
android:name="com.hihonor.push.app_id"
android:value="Your AppId" />
</application>
</manifest>Configure HONOR push when constructing
InitConfig.JIM.InitConfig initConfig = new JIM.InitConfig.Builder()
.setPushConfig(new PushConfig.Builder()
.setHonorConfig()
.build())
.build();ProGuard configuration.
-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keep class com.hihonor.push.**{*;}
-keep class com.juggle.im.push.** {*;}
Add dependencies.
implementation files('libs/OPPOPlugin.aar')
implementation files('libs/com.heytap.msp_3.5.1.aar')
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'commons-codec:commons-codec:1.6'
implementation 'androidx.annotation:annotation:1.1.0'Set the OPPO push
appKeyandappSecretwhen constructingInitConfig.JIM.InitConfig initConfig = new JIM.InitConfig.Builder()
.setPushConfig(new PushConfig.Builder()
.setOppoConfig("appKey", "appSecret")
.build())
.build();ProGuard configuration.
-keep public class * extends android.app.Service
-keep class com.heytap.msp.** { *;}
-keep class com.juggle.im.push.** {*;}
Add dependencies.
implementation files('libs/VIVOPlugin.aar')
implementation files('libs/vivo_pushSDK_v4.0.4.0_504.aar')Set the VIVO push
appKeyandappIdinbuild.gradlein theappmodule.android {
defaultConfig {
manifestPlaceholders = [
"VIVO_APPKEY": "appKey",
"VIVO_APPID" : "appId",
]
}
}Configure VIVO push when constructing
InitConfig.JIM.InitConfig initConfig = new JIM.InitConfig.Builder()
.setPushConfig(new PushConfig.Builder()
.setVivoConfig()
.build())
.build();ProGuard configuration.
-dontwarn com.vivo.push.**
-keep class com.vivo.push.**{*; }
-keep class com.vivo.vms.**{*; }
-keep class com.juggle.im.push.** {*;}
Add dependencies.
implementation files('libs/GooglePlugin.aar')
implementation(platform('com.google.firebase:firebase-bom:32.0.0'))
implementation("com.google.firebase:firebase-messaging")Add configuration to
build.gradlein the project root.repositories {
google()
}
dependencies {
classpath 'com.google.gms:google-services:4.3.15'
}Add configuration to
build.gradlein theappmodule.plugins {
id 'com.google.gms.google-services'
}Place the Google push configuration file
google-services.jsonin theappmodule directory.ProGuard configuration.
-dontwarn com.google.android.gms.**
-keep class com.google.android.gms.** { *; }
-keep class com.google.firebase.** { *; }
-keep class com.juggle.im.push.** {*;}Navigate when a push notification is tapped.
Add an intent filter.
<intent-filter>
<action android:name="com.j.im.intent.MESSAGE_CLICK" />
</intent-filter>Retrieve parameters and navigate as required by the application.
Intent intent = getIntent();
if (intent != null) {
Bundle bundle = intent.getExtras();
if (bundle != null) {
// message ID
String messageId = bundle.getString("msg_id");
// sender user ID
String senderId = bundle.getString("sender_id");
// conversation ID
String conversationId = bundle.getString("conver_id");
// conversation type
Conversation.ConversationType type = Conversation.ConversationType.setValue(bundle.getInt("conver_type"))
}
}
Add configuration to
build.gradlein theappmodule.android {
......
defaultConfig {
applicationId = "com.xxx.xxx" //package name registered with JPush.
......
ndk {
//Select the .so libraries for the CPU architectures you want to include.
abiFilters += setOf("armeabi-v7a", "arm64-v8a")
// You can also add 'x86', 'x86_64', 'mips', and 'mips64'
}
manifestPlaceholders.apply {
putAll(
mapOf(
"JPUSH_PKGNAME" to applicationId,
//AppKey associated with the package registered on JPush.
"JPUSH_APPKEY" to "Your AppKey",
//Use the default value for now.
"JPUSH_CHANNEL" to "developer-default"
)
)
}
......
}
}
dependencies {
implementation(files("libs/JGPlugin.aar"))
implementation("cn.jiguang.sdk:jpush:5.2.4")
}Configure JPush when constructing
InitConfig.JIM.InitConfig initConfig = new JIM.InitConfig.Builder()
.setPushConfig(new PushConfig.Builder()
.setJgConfig()
.build())
.build();ProGuard configuration.
-dontoptimize
-dontpreverify
-dontwarn cn.jpush.**
-keep class cn.jpush.** { *; }
-keep class * extends cn.jpush.android.service.JPushMessageReceiver { *; }
-dontwarn cn.jiguang.**
-keep class cn.jiguang.** { *; }
-keep class com.juggle.im.push.** {*;}