很奇怪的是,用手机同样的操作系统
GsmCellLocation mGsmCellLocation = (GsmCellLocation) mTelephonyManager.getCellLocation();mGsmCellLocation 确实可以获取信息。
GsmCellLocation mGsmCellLocation = (GsmCellLocation) mTelephonyManager.getCellLocation();mGsmCellLocation 确实可以获取信息。
1 : 主小区信源信息
MCC, MNC, LAC, CI, BSIC, BCCH Freq (absolute), RxLev,RxLev Full, RxLev Sub, RxQual, RxQual Full, RxQual Sub, Idle TS
public CellLocation getCellLocation() { try {
Bundle bundle = getITelephony().getCellLocation();
CellLocation cl = CellLocation.newFromBundle(bundle); if (cl.isEmpty())
return null;
return cl; } catch (RemoteException ex) { return null;
} catch (NullPointerException ex) {
应用层:
TelephonyManager mTelephonyManager = (TelephonyManager) this.getSystemService(Service.TELEPHONY_SERVICE);
if (mTelephonyManager == null) {
ShowDebugInfo("mTelephonyManager == null");
return;
}
GsmCellLocation mGsmCellLocation = (GsmCellLocation)mTelephonyManager.getCellLocation();只要mTelephonyManager.getCellLocation();中到底层 return cl CL不为NULL就会报出异常!!!!!!!!!!!!!!!!!!!
D/AndroidRuntime( 446): Shutting down VM
W/dalvikvm( 446): threadid=1: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRuntime( 446): FATAL EXCEPTION: main
E/AndroidRuntime( 446): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.wmi/com.wmi.wmiact}: java.lang.StringIndexOutOfBoundsException
E/AndroidRuntime( 446): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1622)
E/AndroidRuntime( 446): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
E/AndroidRuntime( 446): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime( 446): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:9在模拟器上是好滴。。什么情况?
联网和获取基站信息还是不一样的吧,我这边是通过PPPD拨号上网的,不上网一样获取基站信息,可能我的意思表达不清楚,我是想想1.6/1.5版本那样利用打包好的MAP.JAR文件,然后打开,在其上定位。以前的GPS定位。就是这样的吧
http://mymobiletrack.com/mobile/space.php?uid=2445&do=blog&id=1004