get telephony Proxy Ip - Android Network

Android examples for Network:Proxy

Description

get telephony Proxy Ip

Demo Code


//package com.java2s;

import android.content.Context;

import android.database.Cursor;

import android.net.Uri;

public class Main {
    public static String getProxyIp(String paramString, Context context) {
        if (paramString == null)
            return null;
        Cursor cur = null;//w w  w.  ja  va  2 s .co m
        try {
            Uri uri = Uri.parse("content://telephony/carriers");
            cur = context.getContentResolver().query(uri, null, null, null,
                    null);
            String id;
            do {
                if (cur != null) {
                    boolean bool = cur.moveToNext();
                    if (bool)
                        ;
                } else {
                    return null;
                }
                id = cur.getString(cur.getColumnIndex("_id"));
            } while (!paramString.trim().equals(id));
            return cur.getString(cur.getColumnIndex("proxy"));
        } finally {
            if (cur != null)
                cur.close();
        }

    }
}

Related Tutorials