zl程序教程

您现在的位置是:首页 >  移动开发

当前栏目

android获取当前接入点信息判断是ctwap还是ctnet实例代码

Android实例代码 获取 信息 判断 当前 还是
2023-06-13 09:15:13 时间
复制代码代码如下:

/**
    *获取当前的接入点是ctwap还是ctnet
   *@author<ahref="mailto:yejiurui@126.com">yejiurui</a>
    *@version1.02013-5-17下午5:46:05 2013
    */
   private StringCTWAP="ctwap";
   private StringCTNET="ctnet";
   private UriPREFERRED_APN_URI=Uri
       .parse("content://telephony/carriers/preferapn");

   public StringgetApnType(Contextcontext){
       Stringapntype="nomatch";
       Cursorc=context.getContentResolver().query(PREFERRED_APN_URI,null,
               null,null,null);
       c.moveToFirst();
       Stringuser=c.getString(c.getColumnIndex("apn"));
       if(user.startsWith(CTNET)){
           apntype=CTNET;
       }elseif(user.startsWith(CTWAP)){
           apntype=CTWAP;
       }
       returnapntype;
   }