confirm and test if data receiving from server on android studio

﹥>﹥吖頭↗ 提交于 2019-12-08 11:37:42

问题


I have an application that relies mostly on communication with the server ... The application contains a book that the customer can buy parts of it and there are several other things (such as small game and coins and in_app_billing). The problem is that in the Internet is not good will happen to communicate with The server. In your opinion what is the solution to this problem, so how can I make sure that the information has arrived and in case you did not arrive to return the ball until the information arrives or for example after 30 seconds of the attempt showed him a message that it is impossible to reach Network.

using:

Runnable runnable = new Runnable(),URL insertUserUrl = new URL(url);
HttpURLConnection result;
InputStreamReader resultStreamReader = new InputStreamReader(insertConnection.getInputStream());
BufferedReader resultReader = new BufferedReader(resultStreamReader);
result = resultReader.readLine();

Please reply and thank you very much

来源:https://stackoverflow.com/questions/52114554/confirm-and-test-if-data-receiving-from-server-on-android-studio

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!