求助:极光推送APIRequestException

sdk
标签: #<Tag:0x00007fb846218f30>

(神级大肉肉) #1

PushPayload对象创建代码

public static PushPayload buildAndroidPushObject() {
		 return PushPayload.newBuilder()
	                .setPlatform(Platform.android())
	                .setAudience(Audience.alias("09050002"))
	                .setNotification(Notification.newBuilder()
	                        .addPlatformNotification(AndroidNotification.newBuilder()
	                                .setAlert("2018年10月25日09:23:22")
	                                .addExtra("from", "JPush")
	                                .build()).build())
	                .setNotification(Notification.android("推送时间", "2018年10月25日09:25:46", null))
	                 .setMessage(Message.content("推送content"))
	                 .setOptions(Options.newBuilder()
	                         .setApnsProduction(true)
	                         .build())
	                 .build();
    }

报错日志:极光推送请求失败

{}
	at cn.jiguang.common.connection.NativeHttpClient._doRequest(NativeHttpClient.java:235)
	at cn.jiguang.common.connection.NativeHttpClient.doRequest(NativeHttpClient.java:99)
	at cn.jiguang.common.connection.NativeHttpClient.sendPost(NativeHttpClient.java:86)
	at cn.jpush.api.push.PushClient.sendPush(PushClient.java:160)
	at cn.jpush.api.JPushClient.sendPush(JPushClient.java:193)
	at com.example.demo.controller.JGSendController.download(JGSendController.java:46)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:800)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1471)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Unknown Source)

#2

参考 example try catch 具体的错误信息,这个错误信息里面没有看到 错误码也没有 caused by


(神级大肉肉) #3

谢谢 :grin:


(神级大肉肉) #4
return PushPayload.newBuilder()
	                .setPlatform(Platform.android())
//	                .setAudience(Audience.alias("09050002"))
	                .setAudience(Audience.all())
	                .setNotification(Notification.android("推送时间", "2018年10月25日09:25:46", null))
	                 .setMessage(Message.content("珍珠奶茶珍好嚯"))
	                .build();

这样推送的PushPayLoad,客户端能收到alert通知和信息两种,我也没有加alert通知,怎么把alert去掉


#5

Notification 就是 通知,通知里面第一个参数应该就是 alert 吧?

你如果不需要 Notification,就把 Notification 去掉咯,只发 Message


(神级大肉肉) #6

解决了,谢谢了


(神级大肉肉) #7

请问ReceivedsResult的api有吗?谢谢了


#8

这是什么 API?详述你的需求?你要查什么?


(神级大肉肉) #9

我查询了一次推送的记录返回json为{
“originalContent”: “[{“msg_id”:“81631416”}]”,
“rateLimitQuota”: 2400,
“rateLimitRemaining”: 2383,
“rateLimitReset”: 55,
“received_list”: [
{
“android_received”: 0,
“ios_apns_received”: 0,
“ios_apns_sent”: 0,
“ios_msg_received”: 0,
“msg_id”: 81631416,
“wp_mpns_sent”: 0
}
],
“responseCode”: 200,
“resultOK”: true
}
想知道这些字段的含义


#10

https://docs.jiguang.cn/jpush/server/push/rest_api_v3_report/#_3
文档说明


(神级大肉肉) #11

这个我已经看过了,有些字段还是不清楚比如rateLimitQuota,rateLimitRemaining,还有就是我的客户端明明已经收到消息了,查询的数据还都是0


#12

这是频率限制说明
https://docs.jiguang.cn/jpush/server/push/server_overview/#api_1

report API 一分钟(60 秒)内最多允许调用 2400次,你现在还剩 2383 次,55 秒后重新计算。

report API查到的数据是有延迟的,统计端数据还没跑完任务等情况下,就还查不到准确的数据。


(神级大肉肉) #13

20分钟过去了,还是查不到么,延迟时间有那么长吗?或者需要付费才能查询准确送达情况呢


(神级大肉肉) #14

请问查询接口能返回具体成功的alias号吗?我调用api通知了一台安卓客户端别名为09050001,返回的仅仅只能知道android_received==1,


#15

这个是不能的,最多你可以用 registrationID 去查这个设备送达了没有
https://docs.jiguang.cn/jpush/server/push/rest_api_v3_report/#_7

别名和registrationID 应该报错在你的服务器