Android examples for Phone:Network
get the Network connection proxy and port
//package com.java2s; import android.content.Context; import android.database.Cursor; import android.net.Uri; public class Main { /**//from w w w .ja va2s.c o m * get the connection proxy and port * @param context * @return */ public static String[] getHostAndProxy(Context context) { Uri uri = Uri.parse("content://telephony/carriers/preferapn"); Cursor mCursor = context.getContentResolver().query(uri, null, null, null, null); if (mCursor != null) { mCursor.moveToNext(); String proxyStr = mCursor.getString(mCursor .getColumnIndex("proxy")); String port = mCursor.getString(mCursor.getColumnIndex("port")); return new String[] { proxyStr, port }; } return null; } }