问:
2020-03-03 14:37:05.296 15790-15834/com.baidu.push.example W/System: A resource failed to call end.
2020-03-03 14:37:07.622 15790-15790/com.baidu.push.example I/System.out: URL:[http://api.push.baidu.com/rest/3.0/push/single_device]
2020-03-03 14:37:07.623 15790-15790/com.baidu.push.example I/System.out: params:[apikey=mStmbelQijtZNiuChUFrrMaCxUN2a8rM&channel_id=4604334939770920318&device_type=3&msg=%7B%22title%22%3A%22TEST%22%2C%22description%22%3A%22Hello+Baidu+Push%22%2C%22notification_builder_id%22%3A0%2C%22notification_basic_style%22%3A4%2C%22open_type%22%3A1%2C%22url%22%3A%22http%3A%2F%2Fpush.baidu.com%22%2C%22custom_content%22%3A%7B%22key%22%3A%22value%22%7D%7D&msg_expires=3600&msg_type=1&sign=4902fc4038683b17f7a324d43cfce640×tamp=1583217427]
2020-03-03 14:37:07.623 15790-15790/com.baidu.push.example I/System.out: HttpStatusCode:[-1]
2020-03-03 14:37:07.623 15790-15790/com.baidu.push.example I/System.out: Response:[Network connect fail, domain[api.push.baidu.com] exists?]
2020-03-03 14:37:07.625 15790-15790/com.baidu.push.example W/System.err: com.baidu.push.server.exception.PushClientException: Network connect fail, domain[api.push.baidu.com] exists?
2020-03-03 14:37:07.625 15790-15790/com.baidu.push.example W/System.err: at com.baidu.push.server.BaiduPushClient.process(BaiduPushClient.java:69)
2020-03-03 14:37:07.626 15790-15790/com.baidu.push.example W/System.err: at com.baidu.push.server.BaiduPushClient.pushMsgToSingleDevice(BaiduPushClient.java:41)
2020-03-03 14:37:07.626 15790-15790/com.baidu.push.example W/System.err: at com.baidu.push.example.PushDemoActivity.pushMsg(PushDemoActivity.java:293)
2020-03-03 14:37:07.626 15790-15790/com.baidu.push.example W/System.err: at com.baidu.push.example.PushDemoActivity.onClick(PushDemoActivity.java:154)
2020-03-03 14:37:07.626 15790-15790/com.baidu.push.example W/System.err: at android.view.View.performClick(View.java:7125)
2020-03-03 14:37:07.626 15790-15790/com.baidu.push.example W/System.err: at android.view.View.performClickInternal(View.java:7102)
2020-03-03 14:37:07.626 15790-15790/com.baidu.push.example W/System.err: at android.view.View.access$3500(View.java:801)
2020-03-03 14:37:07.626 15790-15790/com.baidu.push.example W/System.err: at android.view.View$PerformClick.run(View.java:27336)
2020-03-03 14:37:07.626 15790-15790/com.baidu.push.example W/System.err: at android.os.Handler.handleCallback(Handler.java:883)
2020-03-03 14:37:07.626 15790-15790/com.baidu.push.example W/System.err: at android.os.Handler.dispatchMessage(Handler.java:100)
2020-03-03 14:37:07.626 15790-15790/com.baidu.push.example W/System.err: at android.os.Looper.loop(Looper.java:214)
2020-03-03 14:37:07.626 15790-15790/com.baidu.push.example W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7356)
2020-03-03 14:37:07.626 15790-15790/com.baidu.push.example W/System.err: at java.lang.reflect.Method.invoke(Native Method)
2020-03-03 14:37:07.626 15790-15790/com.baidu.push.example W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
2020-03-03 14:37:07.626 15790-15790/com.baidu.push.example W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
在windows下能ping通,在安卓模拟器里打开这个网址是可以访问的,但在app里推送就不行了
C:\Users\lei>ping api.push.baidu.com
正在 Ping api.push.n.shifen.com [61.135.185.171] 具有 32 字节的数据:
来自 61.135.185.171 的回复: 字节=32 时间=39ms TTL=52
来自 61.135.185.171 的回复: 字节=32 时间=39ms TTL=52
来自 61.135.185.171 的回复: 字节=32 时间=39ms TTL=52
来自 61.135.185.171 的回复: 字节=32 时间=39ms TTL=52
61.135.185.171 的 Ping 统计信息:
数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
最短 = 39ms,最长 = 39ms,平均 = 39ms