2012-07-31 25 views
0

我正在調用一個url的應用程序。 撥打電話的方式如下:使用HttpResponse調用url

//… 
    public String doInBackground(String... urls){ 
       String url = urls[0]; 

       try { 
        Log.i("base","Parsing");  
        // defaultHttpClient 
        DefaultHttpClient httpClient = new DefaultHttpClient(); 
        HttpPost httpPost = new HttpPost(url); 

        HttpResponse httpResponse = httpClient.execute(httpPost); 
        HttpEntity httpEntity = httpResponse.getEntity(); 
        xml = EntityUtils.toString(httpEntity); 

       } catch (UnsupportedEncodingException e) { 
        e.printStackTrace(); 
       } catch (ClientProtocolException e) { 
        e.printStackTrace(); 
       } catch (IOException e) { 
        e.printStackTrace(); 
       } 

       return xml; 
      } 

    //... 

new callingUrl().execute("http://www.myurl.com/directory/myxml.xml"); 

我想知道是否通過日誌,否則,任何人都可以看到我稱之爲

的網址,如果是這樣,反正是有隱藏?

非常感謝你提前

問候

+0

使用'HttpURLConnection'而不是'DefaultHttpClient' ... Android團隊最積極地維護它。 – 2012-07-31 21:29:31

回答

1

任何智能用戶可以看到它,如果他們看你的HTTP流量通過外部手段,除非你使用SSL。除此之外,除非您自己登錄或拋出異常,否則會發生打印URL的情況,我不認爲應該通過日誌訪問它。而且,從Android 4.1開始,apps can't read logs

我也問你爲什麼要隱藏URL。如果你是一個好人,通過默默無聞的安全性很少起作用。如果你爲了邪惡的目的而隱藏它,你是邪惡的。 :)

+0

哈哈! noooo,我是一個好人:)謝謝你的民間 – Sergio76 2012-07-31 20:54:06