WEB开发网      婵傜晫鐝總钘夊瀻娴滎偓绱掓担鐘垫畱娑撯偓娴犺棄鍨庢禍顐fЦ閹存垳婊戦惃鍕娴犺棄濮╅崝娑崇幢鐠囧嘲鍨庢禍锟� ---閿曪拷
开发学院手机开发Android 开发 Android APN 设置及获得手机号 阅读

Android APN 设置及获得手机号

 2010-03-24 15:45:00 来源:WEB开发网 閵嗭拷閸戝繐鐨€涙ぞ缍�婢х偛銇囩€涙ぞ缍�閵嗭拷  閸忚櫕鏁為弶銊︿航妞嬬偟娈戝顔煎触
核心提示:目前供职于电信,只做电信的业务,Android APN 设置及获得手机号,故列表中只有电信的APN信息Java代码/*** 电信APN列表* @author wudongdong**/public class APNNET {public static String CTWAP="ctwap";pu

目前供职于电信,只做电信的业务,故列表中只有电信的APN信息

Java代码

/**

* 电信APN列表

* @author wudongdong

*

*/

public class APNNET {

public static String CTWAP="ctwap";

public static String CTNET="ctnet";

}

/**

* 电信APN列表

* @author wudongdong

*

*/

public class APNNET {

public static String CTWAP="ctwap";

public static String CTNET="ctnet";

}

获得APN的类型

Java代码

/**

* 获得APN类型

* @author wudongdong

*

*/

public class ApnUtil {

private static Uri PREFERRED_APN_URI = Uri

.parse("content://telephony/carriers/preferapn");

/**

* get apntype

* @param context

* @return

*/

public static String getApnType(Context context){

String apntype="nomatch";

Cursor c = context.getContentResolver().query(PREFERRED_APN_URI,

null, null, null, null);

c.moveToFirst();

String user=c.getString(c.getColumnIndex("user"));

if(user.startsWith(APNNET.CTNET)){

apntype=APNNET.CTNET;

}else if(user.startsWith(APNNET.CTWAP)){

apntype=APNNET.CTWAP;

}

return apntype;

}

}

/**

* 获得APN类型

* @author wudongdong

*

*/

public class ApnUtil {

private static Uri PREFERRED_APN_URI = Uri

.parse("content://telephony/carriers/preferapn");

/**

* get apntype

* @param context

* @return

*/

public static String getApnType(Context context){

String apntype="nomatch";

1 2  下一页

Tags:Android APN 设置

编辑录入:coldstar [复制链接] [打 印]
赞助商链接