开发者社区> 问答> 正文

移动推送Android SDK:Android辅助通道和弹窗排查步骤



1 参数检查


检查控制台App详情中,在各个平台上获取的相关参数是否一一对应

2 终端集成确认



2.1 华为通道


华为通道初始化成功,可以看到以下日志:

  1. [backcolor=transparent]11[backcolor=transparent]-[backcolor=transparent]11[backcolor=transparent] [backcolor=transparent]22[backcolor=transparent]:[backcolor=transparent]21[backcolor=transparent]:[backcolor=transparent]33.671[backcolor=transparent]  [backcolor=transparent]30248[backcolor=transparent]-[backcolor=transparent]30324[backcolor=transparent]/[backcolor=transparent]com[backcolor=transparent].[backcolor=transparent]xxx E[backcolor=transparent]/[backcolor=transparent]MPS[backcolor=transparent]:[backcolor=transparent]HuaWeiRegister[backcolor=transparent]:[backcolor=transparent] [backcolor=transparent]HuaWeiRegister[backcolor=transparent] checkDevice flag[backcolor=transparent]=[backcolor=transparent]true[backcolor=transparent] [backcolor=transparent]//确认是华为的手机
  2. [backcolor=transparent]11[backcolor=transparent]-[backcolor=transparent]11[backcolor=transparent] [backcolor=transparent]22[backcolor=transparent]:[backcolor=transparent]21[backcolor=transparent]:[backcolor=transparent]33.674[backcolor=transparent]  [backcolor=transparent]30248[backcolor=transparent]-[backcolor=transparent]30324[backcolor=transparent]/[backcolor=transparent]com[backcolor=transparent].[backcolor=transparent]xxx E[backcolor=transparent]/[backcolor=transparent]MPS[backcolor=transparent]:[backcolor=transparent]HuaWeiRegister[backcolor=transparent][backcolor=transparent] [backcolor=transparent]Register[backcolor=transparent] huawei push[backcolor=transparent]............[backcolor=transparent]      [backcolor=transparent]//开始注册华为手机
  3. [backcolor=transparent]11[backcolor=transparent]-[backcolor=transparent]11[backcolor=transparent] [backcolor=transparent]22[backcolor=transparent]:[backcolor=transparent]21[backcolor=transparent]:[backcolor=transparent]33.714[backcolor=transparent]  [backcolor=transparent]29643[backcolor=transparent]-[backcolor=transparent]30328[backcolor=transparent]/[backcolor=transparent]com[backcolor=transparent].[backcolor=transparent]xxx E[backcolor=transparent]/[backcolor=transparent]MPS[backcolor=transparent]:[backcolor=transparent]HuaWeiRegister[backcolor=transparent][backcolor=transparent] huawei [backcolor=transparent]register[backcolor=transparent] success[backcolor=transparent][backcolor=transparent]token [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]08657430243125472000000411000001
  4. [backcolor=transparent]11[backcolor=transparent]-[backcolor=transparent]11[backcolor=transparent] [backcolor=transparent]22[backcolor=transparent]:[backcolor=transparent]21[backcolor=transparent]:[backcolor=transparent]33.714[backcolor=transparent]  [backcolor=transparent]29643[backcolor=transparent]-[backcolor=transparent]30328[backcolor=transparent]/[backcolor=transparent]com[backcolor=transparent].[backcolor=transparent]xxx E[backcolor=transparent]/[backcolor=transparent]MPS[backcolor=transparent]:[backcolor=transparent]HuaWeiRegister[backcolor=transparent][backcolor=transparent] report huaweiPushId intent[backcolor=transparent]...[backcolor=transparent]         [backcolor=transparent]//完成华为注册和信息上报

有时没有注册信息上报,只要注册成功,返回token就是初始化成功的

2.2 小米通道


小米通道初始化成功,可以看到以下日志:
  1. [backcolor=transparent]12[backcolor=transparent]-[backcolor=transparent]09[backcolor=transparent] [backcolor=transparent]22[backcolor=transparent]:[backcolor=transparent]20[backcolor=transparent]:[backcolor=transparent]39.710[backcolor=transparent] [backcolor=transparent]19566[backcolor=transparent]-[backcolor=transparent]19566[backcolor=transparent]/[backcolor=transparent]com[backcolor=transparent].[backcolor=transparent]xxx E[backcolor=transparent]/[backcolor=transparent]MPS[backcolor=transparent]:[backcolor=transparent]MiPushRegister[backcolor=transparent]:[backcolor=transparent] [backcolor=transparent]MiPushRegister[backcolor=transparent] checkDevice flag[backcolor=transparent]=[backcolor=transparent]true[backcolor=transparent] [backcolor=transparent]//确认是小米的手机
  2. [backcolor=transparent]12[backcolor=transparent]-[backcolor=transparent]09[backcolor=transparent] [backcolor=transparent]22[backcolor=transparent]:[backcolor=transparent]20[backcolor=transparent]:[backcolor=transparent]39.712[backcolor=transparent] [backcolor=transparent]19566[backcolor=transparent]-[backcolor=transparent]19566[backcolor=transparent]/[backcolor=transparent]com[backcolor=transparent].[backcolor=transparent]xxx E[backcolor=transparent]/[backcolor=transparent]MPS[backcolor=transparent]:[backcolor=transparent]MiPushRegister[backcolor=transparent]:[backcolor=transparent] [backcolor=transparent]Register[backcolor=transparent] mipush[backcolor=transparent].[backcolor=transparent]                     [backcolor=transparent]//开始注册小米
  3. [backcolor=transparent]12[backcolor=transparent]-[backcolor=transparent]09[backcolor=transparent] [backcolor=transparent]22[backcolor=transparent]:[backcolor=transparent]20[backcolor=transparent]:[backcolor=transparent]40.596[backcolor=transparent] [backcolor=transparent]19566[backcolor=transparent]-[backcolor=transparent]19733[backcolor=transparent]/[backcolor=transparent]com[backcolor=transparent].[backcolor=transparent]xxx E[backcolor=transparent]/[backcolor=transparent]MPS[backcolor=transparent]:[backcolor=transparent]MiPushRegister[backcolor=transparent]:[backcolor=transparent] [backcolor=transparent]XiaoMi[backcolor=transparent] [backcolor=transparent]register[backcolor=transparent] success[backcolor=transparent].[backcolor=transparent]             [backcolor=transparent]//小米注册成功 regid=d//igwEhgBGCI2TG6lWqlCesc0I6xE1wUhNCBXQ8uNOi/dDZioYXVysbrVrvRmyEVPn9nWz92D28IzYbA1RzoGDyTzYZwXKfBHEQkrey4G8=


2.3 GCM/FCM通道


GCM/FCM通道初始化成功,可以看到以下日志:
  1. [backcolor=transparent]05[backcolor=transparent]-[backcolor=transparent]19[backcolor=transparent] [backcolor=transparent]19[backcolor=transparent]:[backcolor=transparent]18[backcolor=transparent]:[backcolor=transparent]44.530[backcolor=transparent] [backcolor=transparent]19153[backcolor=transparent]-[backcolor=transparent]19177[backcolor=transparent]/[backcolor=transparent]com[backcolor=transparent].[backcolor=transparent]xxx D[backcolor=transparent]/[backcolor=transparent]MPS[backcolor=transparent]:[backcolor=transparent]GcmRegister[backcolor=transparent]:[backcolor=transparent] token [backcolor=transparent]from[backcolor=transparent] [backcolor=transparent]register[backcolor=transparent]:[backcolor=transparent] eWIXLYCNP0Q[backcolor=transparent]:[backcolor=transparent]APA91bFUAgxj6XYf5okyoCBnRPw1UwITndzXrvPDgbdI2N44PYm17hFEBiNXNQJrJ8bOG_xjw3c3UPDAhzNMTLNjlAKcjUanKyLA6E3k4wEmgZuhgUT02UMmMvH2LVA1L2Z4[backcolor=transparent]-[backcolor=transparent]l[backcolor=transparent]-[backcolor=transparent]cT_Ug


2.4 检查辅助弹窗配置


接入推送辅助通道,确保使用最新的辅助通道扩展包,查看当前设备是否支持辅助弹窗(小米辅助弹窗:v2.3.0及以上支持;华为辅助弹窗:v3.0.8及以上支持, 华为弹窗当前只支持EmotionUI 4.1及以上设备
指定打开的托管弹窗Activity,需要继承AndroidPopupActivity,并在AndroidManifest.xml中注册时需要声明属性:android:exported=true
  1. [backcolor=transparent]import[backcolor=transparent] com[backcolor=transparent].[backcolor=transparent]alibaba[backcolor=transparent].[backcolor=transparent]sdk[backcolor=transparent].[backcolor=transparent]android[backcolor=transparent].[backcolor=transparent]push[backcolor=transparent].[backcolor=transparent]AndroidPopupActivity[backcolor=transparent];
  2. [backcolor=transparent]public[backcolor=transparent] [backcolor=transparent]class[backcolor=transparent] [backcolor=transparent]PopupPushActivity[backcolor=transparent] [backcolor=transparent]extends[backcolor=transparent] [backcolor=transparent]AndroidPopupActivity[backcolor=transparent] [backcolor=transparent]{
  3. [backcolor=transparent]    [backcolor=transparent]static[backcolor=transparent] [backcolor=transparent]final[backcolor=transparent] [backcolor=transparent]String[backcolor=transparent] TAG [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]"PopupPushActivity"[backcolor=transparent];
  4. [backcolor=transparent]    [backcolor=transparent]@Override
  5. [backcolor=transparent]    [backcolor=transparent]protected[backcolor=transparent] [backcolor=transparent]void[backcolor=transparent] onCreate[backcolor=transparent]([backcolor=transparent]Bundle[backcolor=transparent] savedInstanceState[backcolor=transparent])[backcolor=transparent] [backcolor=transparent]{
  6. [backcolor=transparent]        [backcolor=transparent]super[backcolor=transparent].[backcolor=transparent]onCreate[backcolor=transparent]([backcolor=transparent]savedInstanceState[backcolor=transparent]);
  7. [backcolor=transparent]    [backcolor=transparent]}
  8. [backcolor=transparent]    [backcolor=transparent]/**
  9. [backcolor=transparent]     * 实现通知打开回调方法,获取通知相关信息
  10. [backcolor=transparent]     * @param title     标题
  11. [backcolor=transparent]     * @param summary   内容
  12. [backcolor=transparent]     * @param extMap    额外参数
  13. [backcolor=transparent]     */
  14. [backcolor=transparent]    [backcolor=transparent]@Override
  15. [backcolor=transparent]    [backcolor=transparent]protected[backcolor=transparent] [backcolor=transparent]void[backcolor=transparent] onSysNoticeOpened[backcolor=transparent]([backcolor=transparent]String[backcolor=transparent] title[backcolor=transparent],[backcolor=transparent] [backcolor=transparent]String[backcolor=transparent] summary[backcolor=transparent],[backcolor=transparent] [backcolor=transparent]Map[backcolor=transparent]<[backcolor=transparent]String[backcolor=transparent],[backcolor=transparent] [backcolor=transparent]String[backcolor=transparent]>[backcolor=transparent] extMap[backcolor=transparent])[backcolor=transparent] [backcolor=transparent]{
  16. [backcolor=transparent]        [backcolor=transparent]Log[backcolor=transparent].[backcolor=transparent]d[backcolor=transparent]([backcolor=transparent]"OnMiPushSysNoticeOpened, title: "[backcolor=transparent] [backcolor=transparent]+[backcolor=transparent] title [backcolor=transparent]+[backcolor=transparent] [backcolor=transparent]", content: "[backcolor=transparent] [backcolor=transparent]+[backcolor=transparent] summary [backcolor=transparent]+[backcolor=transparent] [backcolor=transparent]", extMap: "[backcolor=transparent] [backcolor=transparent]+[backcolor=transparent] extMap[backcolor=transparent]);
  17. [backcolor=transparent]    [backcolor=transparent]}
  18. [backcolor=transparent]}


3 服务器端配置


检查服务器端的是否设置了AndroidPopupActivity、AndroidPopupTitle和AndroidPopupBody三个参数以及toreOffline参数也需要设置为true:
  1. [backcolor=transparent]PushRequest[backcolor=transparent] pushRequest [backcolor=transparent]=[backcolor=transparent] [backcolor=transparent]new[backcolor=transparent] [backcolor=transparent]PushRequest[backcolor=transparent]();
  2. [backcolor=transparent]// 其余设置省略
  3. [backcolor=transparent]// ...
  4. [backcolor=transparent]// 0:表示消息(默认为0), 1:表示通知
  5. [backcolor=transparent]pushRequest[backcolor=transparent].[backcolor=transparent]setType[backcolor=transparent]([backcolor=transparent]1[backcolor=transparent]);
  6. [backcolor=transparent]// 标题
  7. [backcolor=transparent]pushRequest[backcolor=transparent].[backcolor=transparent]setTitle[backcolor=transparent]([backcolor=transparent]dateFormat[backcolor=transparent].[backcolor=transparent]format[backcolor=transparent]([backcolor=transparent]new[backcolor=transparent] [backcolor=transparent]Date[backcolor=transparent]()));
  8. [backcolor=transparent]// 内容
  9. [backcolor=transparent]pushRequest[backcolor=transparent].[backcolor=transparent]setBody[backcolor=transparent]([backcolor=transparent]"PushRequest body"[backcolor=transparent]);
  10. [backcolor=transparent]// 额外参数
  11. [backcolor=transparent]pushRequest[backcolor=transparent].[backcolor=transparent]setAndroidExtParameters[backcolor=transparent]([backcolor=transparent]"{\"k1\":\"android\",\"k2\":\"v2\"}"[backcolor=transparent]);
  12. [backcolor=transparent]// 设置辅助弹窗打开Activity
  13. [backcolor=transparent]pushRequest[backcolor=transparent].[backcolor=transparent]setAndroidPopupActivity[backcolor=transparent]([backcolor=transparent]"*****"[backcolor=transparent]);
  14. [backcolor=transparent]// 设置辅助弹窗通知标题
  15. [backcolor=transparent]pushRequest[backcolor=transparent].[backcolor=transparent]setAndroidPopupTitle[backcolor=transparent]([backcolor=transparent]"*****"[backcolor=transparent]);
  16. [backcolor=transparent]// 设置辅助弹窗通知内容
  17. [backcolor=transparent]pushRequest[backcolor=transparent].[backcolor=transparent]setAndroidPopupBody[backcolor=transparent]([backcolor=transparent]"*****"[backcolor=transparent]);
[font=PingFangSC, "]推送测试阶段建议不要使用全量推送,全量推送可能有延迟,容易误导用户。接入阶段建议按deviceId进行推送。 [font=PingFangSC, "]

4 问题仍未解决


若上述步骤仍未能定位问题,可以:

  • 下载钉钉客户端,加入钉钉群(群号:11795523)

  • 或者提交工单,工单请选择类目移动推送。工单地址

展开
收起
猫饭先生 2017-10-23 14:22:20 2091 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
从 SDK 到编解码:视频直播架构解析 立即下载
跨平台的云服务SDK需要什么 立即下载
一个跨平台的云服务SDK需要什么 立即下载