List of usage examples for android.net ConnectivityManager EXTRA_EXTRA_INFO
String EXTRA_EXTRA_INFO
To view the source code for android.net ConnectivityManager EXTRA_EXTRA_INFO.
Click Source Link
From source file:net.primeranks.fs_viewer.fs_replay.ConnectionChangedBroadcastReceiver.java
public void onReceive(Context context, Intent intent) { String info = intent.getStringExtra(ConnectivityManager.EXTRA_EXTRA_INFO); NetworkInfo nwInfo = intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO); Log.d(Config.LOG_AS, info + ": " + nwInfo.getReason()); HttpParams httpParams = EntryPointActivity.getHttpClient().getParams(); if (nwInfo.getType() == ConnectivityManager.TYPE_MOBILE) { String proxyHost = Proxy.getHost(context); if (proxyHost == null) { proxyHost = Proxy.getDefaultHost(); }/*from w w w .j a va2 s. co m*/ int proxyPort = Proxy.getPort(context); if (proxyPort == -1) { proxyPort = Proxy.getDefaultPort(); } if (proxyHost != null && proxyPort > -1) { HttpHost proxy = new HttpHost(proxyHost, proxyPort); httpParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); } else { httpParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, null); } } else { httpParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, null); } }