1. 厂商Push配置
荣耀配置:
maven { url "https://developer.hihonor.com/repo/" }
在app/build.gradle中配置厂商的APP_ID/APP_KEY等参数
manifestPlaceholders = [
//应用的包名
PACKAGE_NAME : android.defaultConfig.applicationId,
"MI_PUSH_APPID" : "@string/MI_PUSH_APPID",
"MI_PUSH_APPKEY" : "@string/MI_PUSH_APPKEY",
"OPPO_PUSH_APPKEY" : "@string/OPPO_PUSH_APPKEY",
"OPPO_PUSH_SECRET" : "@string/OPPO_PUSH_SECRET",
"VIVO_PUSH_APPID" : "@string/VIVO_PUSH_APPID",
"VIVO_PUSH_APPKEY" : "@string/VIVO_PUSH_APPKEY",
"MEIZU_PUSH_APPID" : "@string/MEIZU_PUSH_APPID",
"MEIZU_PUSH_APPKEY": "@string/MEIZU_PUSH_APPKEY",
"HONOR_PUSH_APPID": "@string/HONOR_PUSH_APPID",
//推送服务运行在单独的进程,可配置进程名,如 :push
"PUSH_PROCESS" : ":push"
]
在string.xml中配饰厂商参数的值,厂商秘钥参数的值需要在厂商Push后台注册获取
<!--小米APPID和APPKEY配置-->
<string name="MI_PUSH_APPID"......></string>
<string name="MI_PUSH_APPKEY">......</string>
<!--OPPO push APPKEY和APPKEY配置-->
<string name="OPPO_PUSH_APPKEY">......</string>
<string name="OPPO_PUSH_SECRET"></string>
<!--VIVO push APPID和APPKEY配置-->
<string name="VIVO_PUSH_APPID">......</string>
<string name="VIVO_PUSH_APPKEY">......</string>
<!--MEIZU push -->
<string name="MEIZU_PUSH_APPID">......</string>
<string name="MEIZU_PUSH_APPKEY">......</string>
<string name="HONOR_PUSH_APPID">......</string>
app/build.gradle
添加三方push依赖
//三方push的接入是可插拔方式,可按需选择添加
var thirdPushVersion = "2.5.1.2"
//华为push添加
implementation "com.immomo.cosmos.photon:thirdpush-huawei:$thirdPushVersion"
//小米push添加
implementation "com.immomo.cosmos.photon:thirdpush-xiaomi:$thirdPushVersion"
//oppo push添加
implementation "com.immomo.cosmos.photon:thirdpush-oppo:$thirdPushVersion"
//vivo push添加
implementation "com.immomo.cosmos.photon:thirdpush-vivo:$thirdPushVersion"
//魅族 push添加
implementation "com.immomo.cosmos.photon:thirdpush-meizu:$thirdPushVersion"
//荣耀 push添加
implementation "com.immomo.cosmos.photon:thirdpush-honor:$thirdPushVersion"