推送消息不知道哪里的问题
public static ScheduleResult sendPushMessage(String registrationId, String key, String secret, String mess) throws APIConnectionException, APIRequestException{
ClientConfig config = ClientConfig.getInstance();
HttpProxy proxy = getProxy();
jpushClient = new JPushClient(secret, key, 3, proxy, config);
PushPayload payload = PushPayload.newBuilder()
.setPlatform(Platform.all())
.setAudience(Audience.registrationId(registrationId))
.setNotification(Notification.alert(mess))
.build();
payload.resetOptionsTimeToLive(86400);
payload.resetOptionsApnsProduction(apnsProduction);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar nowTime = Calendar.getInstance();
nowTime.add(Calendar.MINUTE, 5);
String scheduleTime =sdf.format(nowTime.getTime());
System.out.println(mess);
System.out.println(scheduleTime);
System.out.println(UUID.randomUUID().toString().replaceAll("-", ""));
ScheduleResult result = jpushClient.createSingleSchedule(UUID.randomUUID().toString().replaceAll("-", ""), scheduleTime, payload);
return result;
}
报错如下:
[http-8080-5] WARN cn.jpush.api.common.connection.NativeHttpClient - Got error response - responseCode:400, responseContent:{"error":{"message":"The schedule-task is invalid, `push` or `richpush` is invalid:cannot find user by this audience","code":8100}}
[http-8080-5] ERROR cn.jpush.api.common.connection.NativeHttpClient - Your request params is invalid. Please check them according to error message.
at cn.jpush.api.common.connection.NativeHttpClient._doRequest(NativeHttpClient.java:232)
at cn.jpush.api.common.connection.NativeHttpClient.doRequest(NativeHttpClient.java:94)
at cn.jpush.api.common.connection.NativeHttpClient.sendPost(NativeHttpClient.java:81)
at cn.jpush.api.schedule.ScheduleClient.createSchedule(ScheduleClient.java:58)
at cn.jpush.api.JPushClient.createSingleSchedule(JPushClient.java:433)
at files.Push.sendPushMessage(Push.java:95)( **`ScheduleResult result = jpushClient.createSingleSchedule(UUID.randomUUID().toString().replaceAll("-", ""), scheduleTime, payload);`这句的问题)**
at files.Push.push(Push.java:65)
at files.Jpush__do.push(Jpush__do.java:43)
帮忙看一下哪里出错了谢谢
appKey:05022455d51d7aa652e75021
registrationId:100d8559096f70f2b14