极光推送 平台sdk对接
# 小米/vivo/魅族
android/app/build.gradle
manifestPlaceholders = [
JPUSH_PKGNAME : applicationId,
JPUSH_APPKEY : "xxxxxx", // NOTE: JPush 上注册的包名对应的 Appkey.
JPUSH_CHANNEL : "thisPush", //暂时填写默认值即可.
XIAOMI_APPID : "MI-xxxxxxx",
XIAOMI_APPKEY : "MI-xxxxxx",
OPPO_APPKEY : "OP-xxxxxxxx", // OPPO平台注册的appkey
OPPO_APPID : "OP-xxxxxx", // OPPO平台注册的appid
OPPO_APPSECRET: "OP-xxxxxx",//OPPO平台注册的appsecret
VIVO_APPKEY : "xxxxxxx", // VIVO平台注册的appkey
VIVO_APPID : "xxxxxx", // VIVO平台注册的appid
MEIZU_APPKEY : "MZ-xxxxx", // 魅族平台注册的appkey
MEIZU_APPID : "MZ-xxxxxx", // 魅族平台注册的appid
]
```
android/app/build.gradle
```
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.huawei.hms:push:6.5.0.300'
implementation 'cn.jiguang.sdk.plugin:huawei:4.6.6'
compile 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+'
compile 'cn.jiguang.sdk.plugin:xiaomi:4.6.6'//版本号和对应的JPush版本号相同
compile 'cn.jiguang.sdk.plugin:vivo:4.6.6'//版本号和对应的JPush版本号相同
}
apply plugin: 'com.huawei.agconnect'
```
# 华为
http://events.jianshu.io/p/4a89b6b5c459
agconnect-services.json
- shh266 查看签名文件
### 其他问题
极光推送-使用华为厂商通道推送消息-可以收到但是手机顶部没有显示应用图标,没有任何提醒,只能拉开通知栏才能看到
- 静默通知(通知只在下拉通知栏显示,不限时横幅通知。锁屏和状态图标,不振铃不震动)
- 解决:通知管理 - 应用 - 静默通知关闭 - 锁屏通知开启、横幅通知开启
- 通知没有亮屏 - 通知管理 - 更多设置 - 开启
报错代码:6003
解决:原因 debug 模式没有签名
```xml
buildTypes {
release {
signingConfig signingConfigs.release
proguardFiles 'proguard-rules.pro'
}
debug {
minifyEnabled false
signingConfig signingConfigs.release // 调试模式下 也能匹配华为消息推送签名
}
}
dependencies {
implementation 'com.huawei.hms:push:6.5.0.300'
implementation 'cn.jiguang.sdk.plugin:huawei:4.7.2'
}
apply plugin: 'com.huawei.agconnect'
```
添加华为依赖
android->build.gradle
```
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://developer.huawei.com/repo/' }
}
dependencies {
classpath 'com.android.tools.build:gradle'
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.huawei.agconnect:agcp:1.6.0.300'
}
}
allprojects {
repositories {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://developer.huawei.com/repo/' }
}
}
```
android/app/src/main/AndroidManifest.xml
```xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"////添加此处代码
package="xxxxxx">
<application
tools:replace="android:label" ////添加此处代码
android:usesCleartextTraffic="true"
......
```
成功消息
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
D/JIGUANG-JPush(29053): [JPushActionImpl] handle third message:intent.plugin.platform.REFRESSH_REGID D/JIGUANG-JPush(29053): [ThirdPushManager] [refreshToken] romType: 2 // 极光推送类型 D/JIGUANG-JPush(29053): [HWPushHelper] get huawei appId from json:107651563 // 出现华为 AppId I/JIGUANG-JPush(29053): [HWPushHelper] get huawei appId:107651563 // 出现华为 AppId
# 小米
遇到坑
> 小米token已经获取到,到手机依然没收到信息.
解决> 版本过低,更新jpush最新版本 2.3.2 -> 2.4.2
还有另外种可能,小米配额需要几天时间
成功消息
2
3
4
5
6
7
8
[XMPlatformsReceiver] onCommandResult is called. command={register}, resultCode={0}, reason={null}, category={null}, commandArguments={[uowpUNAwFQWM2pxwVCIOKiCNB1+lJ7cEX/JNeR4EETFh1DinyBUL1vr4w+mgiu8B]} D/JIGUANG-JPush(24701): [ActionHelper] doAction:third_action D/JIGUANG-JPush(24701): [XMPlatformsReceiver] xiao mi push register success D/JIGUANG-JPush(24701): [ThirdPushManager] doAction,action:action_register_token,bundle:Bundle[{third_key_action=action_register_token, token=uowpUNAwFQWM2pxwVCIOKiCNB1+lJ7cEX/JNeR4EETFh1DinyBUL1vr4w+mgiu8B, platform=1}],enable:true I/JIGUANG-JPush(24701): [ThirdPushManager] uploadRegID regid:uowpUNAwFQWM2pxwVCIOKiCNB1+lJ7cEX/JNeR4EETFh1DinyBUL1vr4w+mgiu8B
调试 token 拿到 ,但小米没收到通知
> 有可能是配额没有,正确是会有数字配额,不是/

# oppo
[oppo极光集成](https://docs.jiguang.cn/jpush/client/Android/android_3rd_guide#oppo-%E9%80%9A%E9%81%93%E9%9B%86%E6%88%90%E6%8C%87%E5%8D%97)
[官方oppo集成 SDK集成步骤](https://open.oppomobile.com/new/developmentDoc/info?id=11221)
** 添加aac **
* 下载aar文件,即3.1.0版本sdk:com.heytap.msp_3.1.0.aar
* app 新建module -》 libs =》 com.heytap.msp_3.1.0.aar
2
3
4
5
6
7
8
9
10
11
12
13
14
15
dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'com.huawei.hms:push:6.5.0.300' implementation 'cn.jiguang.sdk.plugin:oppo:4.7.2'
// JPush Android SDK v4.6.0 开始,需要单独引入 oppo 厂商 aar ,请下载官网 SDK 包并把 jpush-android-xxx-release/third-push/oppo/libs 下的 aar 文件单独拷贝一份到应用 module/libs 下
implementation(name: 'com.heytap.msp_3.1.0', ext: 'aar')
//以下为 OPPO 3.1.0 aar需要依赖
implementation 'com.google.code.gson:gson:2.6.2'
implementation 'commons-codec:commons-codec:1.6'
implementation 'com.android.support:support-annotations:1.1.0'
}
repositories { flatDir { dirs 'libs' // app => module => libs 文件路径 } }
2
3
4