极光推送,报错,为什么
public static void main(String[] args) {
// testSendPush();
String masterSecret = "注册的,可以使用的";
// 应用的appKey,同样在网站上申请
String appKey = "注册的,可以使用的";
// 建立JpushClient类,用来发送消息的对象
JPushClient client = new JPushClient(masterSecret, appKey);
try {
// client.sendNotificationAll("hello world");
// client.sendMessageAll("this is a message");
PushPayload payload = PushPayload.newBuilder().setPlatform(
Platform.android_ios()).setNotification(
Notification.alert("jPush is useful!!")).setAudience(
Audience.alias("123456")).build();//123456是alias
client.sendPush(payload);
} catch (APIConnectionException e) {
e.printStackTrace();
} catch (APIRequestException e) {
e.printStackTrace();
}
}
报错:
at cn.jpush.api.common.connection.NativeHttpClient._doRequest(NativeHttpClient.java:208)
at cn.jpush.api.common.connection.NativeHttpClient.doRequest(NativeHttpClient.java:72)
at cn.jpush.api.common.connection.NativeHttpClient.sendPost(NativeHttpClient.java:64)
at cn.jpush.api.push.PushClient.sendPush(PushClient.java:111)
at cn.jpush.api.JPushClient.sendPush(JPushClient.java:88)
at cn.jpush.api.examples.PushExample.main(PushExample.java:56)