魏小鹏
魏小鹏
  • 发布:2019-04-10 09:13
  • 更新:2022-12-25 01:21
  • 阅读:3696

UniPush的推送到达率太低

分类:uni-app

最近我将APP的推送从个推改成了UniPush,可是我发现推送的到达率好低呀,我每次重启一下APP之后的第一条推送可能收到,后续的推送一条也收不到了。。。

其中java中的核心方法我贴出来了,各位大佬可以帮忙瞅瞅,有什么大问题吗?

/**  
     * intent模板  
     */  
    private static String intentTemplate = "intent:#Intent;action=android.intent.action.oppopush;component=%s/io.dcloud.PandoraEntry;S.UP-OL-SU=true;S.title=%s;S.content=%s;S.payload=%s;end";  
  
/**  
     * 获取管理APP Intent信息  
     * @param pushMessage 管理员推送消息  
     * @return intent字符串  
     */  
    private static String getManagerIntent(PushMessage pushMessage) {  
        return String.format(intentTemplate, managerAppProperties.getPackageName(), pushMessage.getTitle(), pushMessage.getContent(), ObjectUtils.toJson(pushMessage.getPayload()));  
    }  
  
    /**  
     * 获取司机APP Intent信息  
     * @param pushMessage 司机端推送的消息  
     * @return intent 字符串  
     */  
    private static String getDriverIntent(PushMessage pushMessage) {  
        return String.format(intentTemplate, driverAppProperties.getPackageName(), pushMessage.getTitle(), pushMessage.getContent(), ObjectUtils.toJson(pushMessage.getPayload()));  
    }  
  
   /**  
     * 创建透传模板  
     * @param pushMessage 透传消息对象  
     * @param manager 是否是管理员透传消息  
     * @return 透传模板  
     */  
    private static TransmissionTemplate createTransmissionTemplate(PushMessage pushMessage, boolean manager) {  
        // 创建模板  
        TransmissionTemplate template = new TransmissionTemplate();  
        if (manager) {  
            template.setAppId(managerAppProperties.getAppId());  
            template.setAppkey(managerAppProperties.getAppKey());  
        } else {  
            template.setAppId(driverAppProperties.getAppId());  
            template.setAppkey(driverAppProperties.getAppKey());  
        }  
  
        template.setTransmissionType(2);  
        template.setTransmissionContent(ObjectUtils.toJson(pushMessage));  
  
        Notify notify = new Notify();  
        notify.setTitle(pushMessage.getTitle());  
        notify.setContent(pushMessage.getContent());  
        notify.setIntent(manager ? getManagerIntent(pushMessage) : getDriverIntent(pushMessage));  
        notify.setType(GtReq.NotifyInfo.Type._intent);  
  
        template.set3rdNotifyInfo(notify);  
        return template;  
    }  
  
...
0 关注 分享

要回复文章请先登录注册

魏小鹏

魏小鹏 (作者)

回复 魏小鹏 :
不是 dcloud,是 个推
2022-12-25 01:21
魏小鹏

魏小鹏 (作者)

回复 为人方正实诚 :
使用dcloud rest api 的 sdk 吧,我已经好久没玩这个玩意了
2022-12-25 01:21
为人方正实诚

为人方正实诚

遇到同样的问题
2022-11-12 04:13
7***@qq.com

7***@qq.com

回复 m***@163.com :
确实是,我这边看到
也一直是0
2020-04-27 17:13
lijunshuai

lijunshuai

回复 m***@163.com :
我之前用我公司内的网不行,后来切换到手机流量上就好了,但我公司人说防火墙没限制。我也很懵逼
2019-08-26 16:57
m***@163.com

m***@163.com

回复 lijunshuai :
你解决了吗 我也是。。。 人数永远是0
2019-08-26 15:36
DCloud_heavensoft

DCloud_heavensoft

unipush的后台网页有个推qq客服,可以直接联系
2019-08-22 18:24
7***@qq.com

7***@qq.com

回复 lijunshuai :
// #ifdef APP-PLUS
// 获取设备CID
var pinf = plus.push.getClientInfo();
cid = pinf.clientid;//客户端标识
console.log(cid)
// #endif
2019-08-22 17:58
7***@qq.com

7***@qq.com

回复 lijunshuai :
// #ifdef APP-PLUS
// 获取设备CID
var pinf = plus.push.getClientInfo();
cid = pinf.clientid;//客户端标识
console.log(cid)
// #endif
2019-08-22 17:58
Hb传道者

Hb传道者

回复 lijunshuai :
解决没有, 死活就是不行啊,华为的手机, 一脸的懵逼;
2019-08-22 17:30