Java tutorial
//package com.java2s; import android.content.Context; import android.database.Cursor; import android.net.Uri; public class Main { /** * 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; } }