个推报错result=AppidError

使用个推报错result=AppidError

混合开发,用到unipush.后端用的java
使用按条件发推送没问题,但是给某个cid发送消息一直报错AppidError,把手机里面libs下的文件全部删除,没用,重新获取cid还是没办法。最后的最后在个推技术的提示下,发现自己一直在用真机调试,必须用个推平台登记的应用参数重新云端打包才行。

后端代码如下

@Component
@Data
@ConfigurationProperties(prefix = "getui")
public class GeTuiConfig {


    private String appId;
    private String appKey;
    private String masterSecret;

}

@Configuration
public class PullInit {
    @Autowired
    private GeTuiConfig geTui;

    @Bean
    public IGtPush init(){

        IGtPush pushclient = new IGtPush(geTui.getAppKey(), geTui.getMasterSecret());

        return pushclient;
    }
}

 public  String pushToSingle(IGtPush push,String cid,String title,String content,String funcId,String funcName) {
        NotificationTemplate template = pushTemplate.getNotificationTemplate(title,content,funcId,funcName);//通知模板(点击后续行为: 支持打开应用、发送透传内容、打开应用同时接收到透传 这三种行为)


        // 单推消息类型
        SingleMessage message = getSingleMessage(template);
        Target target = new Target();
        target.setAppId(geTui.getAppId());
        target.setClientId(cid);
        IPushResult ret = null;
        try {
            ret = push.pushMessageToSingle(message, target);
        } catch (PushAppException e) {
            e.printStackTrace();
        }
        if (ret != null) {
            log.info(ret.getResponse().toString());
            if (ret.getResponse().get("taskId")==null){

                log.error("啥j8玩意儿啊");
                return null;
            }
            return ret.getResponse().get("taskId").toString();
        } else {

            log.error("单推发送未知错误服务器响应异常");
            return null;
        }

    }
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值