关于后台集成jpush发送定时任务的问题


(huangzuxiang) #1

求救各位大神,后台集成了JPUSH,返回结果说是成功了,但是客户端到了时间没有收到通知,代码如下:

    public static void testSchedule() {
    	JPushClient jpushClient = new JPushClient(masterSecret, appKey);
    	

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        long schtime = System.currentTimeMillis() + 180000;
        Date date = new Date(schtime);
       
        
        String time = sdf.format(date);
        
        String name = "TESTSCHE" + 1;
//        PushPayload push = PushPayload.messageAll("testschedule example.");
        Message message = Message.newBuilder().setTitle("定时任务测试22"+time).setMsgContent("大家来狂欢吧1111"+time).build();
        //"121c83f76012a8b7dd1","191e35f7e072ad37fb5",
        //Audience ad = Audience.registrationId("1104a897929e8cad4be");
        Audience ad = Audience.all();
        Platform platform = Platform.android();
        PushPayload push = PushPayload.newBuilder().setAudience(ad).setPlatform(platform).setMessage(message).build();
        
        try {
            ScheduleResult result = jpushClient.createSingleSchedule(name, time, push);
            LOG.info("schedule result is " + result);
        } catch (APIConnectionException e) {
            LOG.error("Connection error. Should retry later. ", e);
        } catch (APIRequestException e) {
            LOG.error("Error response from JPush server. Should review and fix it. ", e);
            LOG.info("HTTP Status: " + e.getStatus());
            LOG.info("Error Code: " + e.getErrorCode());
            LOG.info("Error Message: " + e.getErrorMessage());
        }
    
    	
    }

返回结果如下:

17/07/15 16:38:16 INFO connection.NativeHttpClient: Created instance with connectionTimeout 5,000, readTimeout 30,000, maxRetryTimes 3, SSL Version TLS
17/07/15 16:38:17 INFO connection.NativeHttpClient: Created instance with connectionTimeout 5,000, readTimeout 30,000, maxRetryTimes 3, SSL Version TLS
17/07/15 16:38:17 INFO connection.NativeHttpClient: Created instance with connectionTimeout 5,000, readTimeout 30,000, maxRetryTimes 3, SSL Version TLS
17/07/15 16:38:17 INFO connection.NativeHttpClient: Created instance with connectionTimeout 5,000, readTimeout 30,000, maxRetryTimes 3, SSL Version TLS
17/07/15 16:38:17 DEBUG connection.NativeHttpClient: Send request - POST https://api.jpush.cn/v3/schedules
17/07/15 16:38:17 DEBUG connection.NativeHttpClient: Request Content - {"name":"TESTSCHE1","enabled":true,"trigger":{"single":{"time":"2017-07-15 16:41:17"}},"push":{"platform":["android"],"audience":"all","message":{"title":"定时任务测试222017-07-15 16:41:17","msg_content":"大家来狂欢吧11112017-07-15 16:41:17"},"options":{"sendno":145950009,"apns_production":false}}}
17/07/15 16:38:18 DEBUG connection.NativeHttpClient: Succeed to get response OK - responseCode:200
17/07/15 16:38:18 DEBUG connection.NativeHttpClient: Response Content - {"schedule_id":"fe9ba030-6938-11e7-881a-0021f652c102","name":"TESTSCHE1"}
17/07/15 16:38:18 INFO examples.PushExample: schedule result is {"schedule_id":"fe9ba030-6938-11e7-881a-0021f652c102","name":"TESTSCHE1"}

客户端其它及时的消息可以实时收到,在极光管理台也可以查到推送消息,但是接收成功为0,求各位指教。不胜感激


#2

收不到消息的问题:请提供推送的消息的msgid(MessageID)和收不到这条消息的设备的registrationID(在客户端获取,无论以何种方式做推送,该信息必须提供)
信息如何获取: 极光产品相关提问简要说明


(huangzuxiang) #3

您好!
非常感谢回复。所需具体信息如下;
MessageId:29273397745836172
registrationID:1104a897929e8cad4be


#4

2017-07-15 16:41:16
这个时间点发的,这条消息是自定义消息,不是通知!自定义消息不展示!


再就是当时设备不在线,所以没收到,离线保存时间只设置了1天


(huangzuxiang) #5

你好,我又发了一下通知也没有收到消息ID是:20266198509402578


#6

App不在线啊,让他们检查App的长连接状态


(huangzuxiang) #7

现在还没有集成,只是用官方demo,demo是项目的包名。刚开始能接受到,后来接受不到推送了,这是怎么回事,有使用次数吗?


#8

不是,没有这个问题,检查你是不是点了demo首页的stoppush,点一下resumepush再测试下


(huangzuxiang) #9

刚才那个问题已经解决了,确实是你讲的情况,想问下:不是通知!自定义消息不展示! 是什么意思。菜鸟一只,请多多指教。谢谢


#10

怎么不看我给的链接?