1. android如何获取MoNotify中action中的自定义字段?

     Intent intent = Intent.parseUri(notify.action, 0);
    

    通过以上代码获取intent,然后通过intent获取自定义字段。

  2. android获取不到通知的各种情况

    • targetSdkVersion>=26情况需要配置channelId
    • oppo secret配置错误:oppo厂商后台配置app之后,会有appsecret以及appserversecret两个值,其中appsecrect需要在app中配置,而appserversecret需要在控制台中配置;
    • placeholder后要使用@string的方式引入key或id,不要直接填写字符串
    • PushMessageReceiver的回调方法onNotificationShow如果写死return true,会拦截通知;同时如果不return super.onNotificationShow()服务器下发的showOnlyBackstage在前台展示的功能将不起作用,
    • app的通知权限需要手动打开
    • 确保手机不是在勿扰模式
    • 设置channel时通知声音不正确:channel初始化时需要设置为NotificationManager.IMPORTANCE_HIGH
    • vivo手机接收不到通知并有日志:vivo push not support,请查看该机型在官网列表中是否支持。
    • 魅族手机无法收到通知:检查是否添加回执地址:

      https://push.immomo.com/alpha/online/meizu.json
      https://push.immomo.com/alpha/test/meizu.json

    • appid和packagename相同才可以省略action中的包名

  3. 收到厂商push,点击通知进入app,然后点击home进入后台,再次点击app应用图标导致重启问题如何解决?

    需要在app的启动界面设置以下代码

    if (!this.isTaskRoot()) { // 当前类不是该Task的根部,那么之前启动
        Intent intent = getIntent();
        if (intent != null) {
           String action = intent.getAction();
           if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN.equals(action)) { // 当前类是从桌面启动的
              finish(); // finish掉该类,直接打开该Task中现存的Activity
              return;
           }
        }
    }
    
  4. 点击通知栏无法跳转到指定activity或者无法获取action? 确保跳转的activity设置export=true

  5. 点击率统计异常

    5.1:请检查在通知打开的activity的onCreate中调用以下代码统计厂商通知的点击事件

    PhotonPushManager.getInstance().logPushClick(getIntent());
    

    当业务方自行处理push的展示以及点击时需要分别调用以下两个方法统计展示量以及点击量

    PhotonPushManager.getInstance().onPushShow(MoNotify notify, boolean show);
    PhotonPushManager.getInstance().onPushClick(MoNotify notify);
    

    5.2:针对iOS 请检查UNUserNotificationCenter的delegate是使用appdelagte还是自定义的处理类,如果是自定义的处理类,也请把相同的自定义的代理对象设置给MoPushManager。设置可如下处理:

[MoPushManager setNotiCenterDelegate:UNUserNotificationCenter.currentNotificationCenter.delegate];

6.其他问题

  • 服务器下发forceToVendor为true来强制使用厂商push
  • 获取getIntent().getStringExtra获取actionParams中的值
  • 尽量在Application的oncreate里边调用init方法,否则的话,push sdk内部判断app是否在前台的逻辑就会出错。会影响在前台不展示push的场景(这种情况下需要接入方自己判断是否在前台)
  • 厂商配置更新后,离线push收不到的话,需要重新冷启动app(触发注册逻辑),再kill掉,之后就能收到离线push了
  • 安卓启动之后crash的话,检查下,主进程和push进程中是否都有初始化sdk的代码
Copyright © momo 2019 all right reserved,powered by Gitbook修订时间: 2022-08-26 12:21:31

results matching ""

    No results matching ""