android 7.1.1(Nougat)app待机和网络

时间:2017-01-03 09:02:45

标签: android networking android-7.1-nougat android-appstandby

我需要在应用处于后台时发出网络电话。顺序如下。该应用程序接收GCM调用,向BE发出API调用以获取更多数据,然后显示通知。 GCM调用已完全收到,但API网络调用因超时而失败,并显示以下stack-trace

java.net.SocketTimeoutException: timeout
                                                    at okio.Okio$3.newTimeoutException(Okio.java:207)
                                                    at okio.AsyncTimeout.exit(AsyncTimeout.java:250)
                                                    at okio.AsyncTimeout$2.read(AsyncTimeout.java:217)
                                                    at okio.RealBufferedSource.indexOf(RealBufferedSource.java:306)
                                                    at okio.RealBufferedSource.indexOf(RealBufferedSource.java:300)
                                                    at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:196)
                                                    at com.squareup.okhttp.internal.http.Http1xStream.readResponse(Http1xStream.java:186)
                                                    at com.squareup.okhttp.internal.http.Http1xStream.readResponseHeaders(Http1xStream.java:127)
                                                    at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:737)
                                                    at com.squareup.okhttp.internal.http.HttpEngine.access$200(HttpEngine.java:87)
                                                    at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:722)
                                                    at com.nuro.newcoms.NuroCommunicationService$21.intercept(NuroCommunicationService.java:1986)
                                                    at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:695)
                                                    at com.nuro.encryption.NuroSSLContext$1.intercept(NuroSSLContext.java:94)
                                                    at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:695)
                                                    at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:576)
                                                    at com.squareup.okhttp.Call.getResponse(Call.java:287)
                                                    at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:243)
                                                    at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:205)
                                                    at com.squareup.okhttp.Call.execute(Call.java:80)
                                                    at retrofit.client.OkClient.execute(OkClient.java:53)
                                                    at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:326)
                                                    at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
                                                    at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
                                                    at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
                                                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                                                    at java.lang.Thread.run(Thread.java:761)`

我使用okhttp ver 2.7.5retrofit 1.9.0

该应用程序处于后台,但该设备未处于打盹状态,屏幕已打开,甚至正在充电。因此它不能成为DOZE问题。

WiFi3/4G上发生。

pre-nougat设备没有此问题。

UPD 当应用程序被选为"未优化"在电池设置方面,一切都像魅力一样。

0 个答案:

没有答案