English 中文(简体)
风险简介
原标题:Settings.Secure.HTTP_PROXY deprecated in ICS but no information on replacement

The Anders developer docs 他说: 情况。 安全。 HTTP_PROXY:

东道名称和全球http://europa.org 用途:东道方与港口指定主管部门之间的排序—有利于全球_http_proxy_host, 等

但没有关于<代码>全球_http://proxy_host的任何信息。 现在我总是收到<代码>null。 页: 1 情况。 安全。 HTTP_PROXY。

Settings.Secure.HTTP_PROXY在海运公会之前的所有释放中都做了适当的工作。

最佳回答

You can use Java Reflection to set the global proxy tested on ICS.

www.un.org/spanish/ecosoc UPDATED CODE

Activity activity = this;


private void setProxtAndPortOnICS(String porxyServer2, int port2)
{
            try
{
  Class jwcjb = Class.forName("android.webkit.JWebCoreJavaBridge");
  Class params[] = new Class[1];
  params[0] = Class.forName("android.net.ProxyProperties");
  Method updateProxyInstance = jwcjb.getDeclaredMethod("updateProxy", params);

  Class wv = Class.forName("android.webkit.WebView");
  Field mWebViewCoreField = wv.getDeclaredField("mWebViewCore");
  Object mWebViewCoreFieldIntance = getFieldValueSafely(mWebViewCoreField, oauthPage);

  Class wvc = Class.forName("android.webkit.WebViewCore");
  Field mBrowserFrameField = wvc.getDeclaredField("mBrowserFrame");
  Object mBrowserFrame = getFieldValueSafely(mBrowserFrameField, mWebViewCoreFieldIntance);

  Class bf = Class.forName("android.webkit.BrowserFrame");
  Field sJavaBridgeField = bf.getDeclaredField("sJavaBridge");
  Object sJavaBridge = getFieldValueSafely(sJavaBridgeField, mBrowserFrame);

  Class ppclass = Class.forName("android.net.ProxyProperties");
 Class pparams[] = new Class[3];
 pparams[0] = String.class;
 pparams[1] = int.class;
 pparams[2] = String.class;
 Constructor ppcont = ppclass.getConstructor(pparams);

 updateProxyInstance.invoke(sJavaBridge, ppcont.newInstance("my.proxy.com", 1234, null)); 
}
catch (Exception ex)
{    
 }


 }


 private Object getFieldValueSafely(Field field, Object classInstance) throws IllegalArgumentException, IllegalAccessException {
   boolean oldAccessibleValue = field.isAccessible();
   field.setAccessible(true);
   Object result = field.get(classInstance);
   field.setAccessible(oldAccessibleValue);
   return result;      
}

NOW 您可以使用代理服务器过滤器。

OR look at this blog this is in Chinese, but You can Read the code it is fair accessible.

问题回答

我只读到文件所说的话,但读到我的话是:。 情况。 有保障:HTTP_PROXY.n t 目前已折旧。 文件中的(sloppy)说明只是一份发展者的说明,即这是安的团队:may<>/em>今后考虑这样做。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...