Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;
import android.database.Cursor;

import android.net.Uri;

public class Main {
    private static Uri PREFERRED_APN_URI = Uri.parse("content://telephony/carriers/preferapn");
    public static final String APN_PROP_PROXY = "proxy";

    public static String getApnProxy(Context context) {
        Cursor c = context.getContentResolver().query(PREFERRED_APN_URI, null, null, null, null);
        c.moveToFirst();
        if (c.isAfterLast()) {
            c.close();
            return null;
        }
        String strResult = c.getString(c.getColumnIndex(APN_PROP_PROXY));
        c.close();
        return strResult;
    }
}