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).
精彩评论