if (imsi!= null ){
if (imsi.startsWith( "46000" ) || imsi.startsWith( "46002" ) || imsi.startsWith( "46007" )){ //因为移动网络编号46000下的IMSI已经用完,所以虚拟了一个46002编号,134/159号段使用了此编号
//中国移动
} else if (imsi.startsWith( "46001" )){
//中国联通
} else if (imsi.startsWith( "46003" )){
//中国电信
}
}
}
/**
* @author Stay
* 网络连接方式更改时
*/
private class ConnectionChangeReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService( Context.CONNECTIVITY_SERVICE );
NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo();
NetworkInfo mobNetInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE );
if ( activeNetInfo != null ) {
Toast.makeText( context, "Active Network Type : " + activeNetInfo.getTypeName(), Toast.LENGTH_SHORT ).show();
}
if ( mobNetInfo != null ) {
Toast.makeText( context, "Mobile Network Type : " + mobNetInfo.getTypeName(), Toast.LENGTH_SHORT ).show();
}
}
}
/*联通3G卡 wap連接
03-16 16:09:14.754: INFO/MainActivity(977): getDetailedState=CONNECTED
03-16 16:09:14.754: INFO/MainActivity(977): getReason=apnChanged
03-16 16:09:14.754: INFO/MainActivity(977): getSubtype=8
03-16 16:09:14.754: INFO/MainActivity(977): getSubtypeName=HSDPA
03-16 16:09:14.754: INFO/MainActivity(977): getExtraInfo=uniwap
03-16 16:09:14.754: INFO/MainActivity(977): getTypeName=mobile
03-16 16:09:14.754: INFO/MainActivity(977): getType=0
*/
/*联通3G卡 3g连接
03-16 16:13:48.314: INFO/MainActivity(1522): getDetailedState=CONNECTED
03-16 16:13:48.314: INFO/MainActivity(1522): getReason=apnSwitched
03-16 16:13:48.314: INFO/MainActivity(1522): getSubtype=3
03-16 16:13:48.314: INFO/MainActivity(1522): getSubtypeName=UMTS
03-16 16:13:48.314: INFO/MainActivity(1522): getExtraInfo=3gnet
03-16 16:13:48.314: INFO/MainActivity(1522): getTypeName=mobile
03-16 16:13:48.314: INFO/MainActivity(1522): getType=0
*/
/*移动 wap连接
03-16 16:20:39.295: INFO/MainActivity(734): getDetailedState=CONNECTED
03-16 16:20:39.295: INFO/MainActivity(734): getReason=apnChanged
03-16 16:20:39.295: INFO/MainActivity(734): getSubtype=2
03-16 16:20:39.295: INFO/MainActivity(734): getSubtypeName=EDGE
03-16 16:20:39.295: INFO/MainActivity(734): getExtraInfo=cmwap
03-16 16:20:39.295: INFO/MainActivity(734): getTypeName=mobile
03-16 16:20:39.295: INFO/MainActivity(734): getType=0
*/
/*移动 net连接
03-16 16:23:34.045: INFO/MainActivity(734): getDetailedState=CONNECTED
03-16 16:23:34.045: INFO/MainActivity(734): getReason=apnSwitched
03-16 16:23:34.045: INFO/MainActivity(734): getSubtype=2
03-16 16:23:34.045: INFO/MainActivity(734): getSubtypeName=EDGE
03-16 16:23:34.045: INFO/MainActivity(734): getExtraInfo=cmnet
03-16 16:23:34.045: INFO/MainActivity(734): getTypeName=mobile
03-16 16:23:34.045: INFO/MainActivity(734): getType=0
/电信
05-25 18:55:30.180: INFO/MainActivity(731): getDetailedState=DISCONNECTED
05-25 18:55:30.180: INFO/MainActivity(731): getReason=dataDisabled
05-25 18:55:30.180: INFO/MainActivity(731): getSubtype=6
05-25 18:55:30.180: INFO/MainActivity(731): getSubtypeName=CDMA - EvDo rev. A
05-25 18:55:30.180: INFO/MainActivity(731): getExtraInfo=#777
05-25 18:55:30.180: INFO/MainActivity(731): getTypeName=MOBILE
05-25 18:55:30.180: INFO/MainActivity(731): getType=0
*/
}
|