开发者

Can the user see URL called from Android app?

开发者 https://www.devze.com 2023-02-21 01:07 出处:网络
If I have standard URL call in my Android app code HttpClient httpClient = new DefaultHttpClient(); HttpContext localContext = new BasicHttpContext();

If I have standard URL call in my Android app code

                HttpClient httpClient = new DefaultHttpClient();
                HttpContext localContext = new BasicHttpContext();

                String url = "http://www.google.com";

                HttpGet httpGet = new HttpGet(url);
                HttpResponse response = null;
                String result = "";
                try {
                    response = httpClient.execute(httpGet, localContext);
                    BufferedReader reader = null;

                    reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
                    String line = null;

                    while ((line = reader.readLine()) != null){
                         result += line;
                    }
                } catch (IllegalStateException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

My question is - can the user see the URL called here (in this example: www.google.com) in some kind of log or something? I assum开发者_JAVA技巧e that the user with rooted phone could see that information?

Is there a way to hide it/encrypt it?

EDIT: Or, is there a way to check (PHP maybe?) if the user is coming to my website/URL from mobile phone (my application) or not?


Even with a non-rooted phone, a user could run a packet sniffer on their gateway to see where they're connecting.

To "hide" the URL you could proxy its data through your own server, and provide the app with a URL to that server instead.

Edit: Re. your edit, you can check the browser's user agent, but there's no foolproof way to be certain that a user is connecting from your app (it boils down to a DRM problem).

0

精彩评论

暂无评论...
验证码 换一张
取 消