cordova插件用别名推送消息报错,用id是正常的

feeige
2018-02-09 17:22 534 0

代码:HttpProxy proxy = getProxy();
boolean apnsProduction = true;
jpushClient = new JPushClient(secret, key, 3, proxy, config);
PushPayload payload = PushPayload.newBuilder()
.setPlatform(Platform.all())
.setAudience(Audience.alias(aliases))
.setNotification(Notification.alert(mes))
.build();
payload.resetOptionsTimeToLive(86400);
payload.resetOptionsApnsProduction(apnsProduction);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar nowTime = Calendar.getInstance();
nowTime.add(Calendar.SECOND, 1);
String scheduleTime =sdf.format(nowTime.getTime());
ScheduleResult result = jpushClient.createSingleSchedule(UUID.randomUUID().toString().replaceAll("-", ""), scheduleTime, payload);
return result;

报错:---------------------------------------------------------------------------

[http-8080-4] INFO cn.jpush.api.common.connection.NativeHttpClient - Created instance with _maxRetryTimes = 3
[http-8080-4] WARN cn.jpush.api.common.connection.NativeHttpClient - Got error response - responseCode:400, responseContent:{"error":{"message":"trigger->single->time[2018-02-10 01:15:53] is invalid, it has been expired now.","code":8100}}
[http-8080-4] ERROR cn.jpush.api.common.connection.NativeHttpClient - Your request params is invalid. Please check them according to error message.
{}

1个回答

热门排序
  • feeige
    采纳 2018-02-09 17:25

    已解决,nowTime.add(Calendar.SECOND, 1);这个时间调成10秒就可以了