Android GsmCellLocation.getCellLocation返回NULL


Android GsmCellLocation.getCellLocation返回NULL   

 1、首先 獲取服務 telephonyManager =(TelephonyManager)
getSystemService(TELEPHONY_SERVICE);

// 2、注冊監聽器 telephonyManager.listen(celllistener,
// PhoneStateListener.LISTEN_CELL_LOCATION); // 基站位置的變化
//
// 3、編寫監聽代碼
// public PhoneStateListener celllistener = new PhoneStateListener() {
// @Override
// public void onCellLocationChanged(CellLocation location) {
// super.onCellLocationChanged(location);
// // 判斷 location的類型 是GsmCellLocation 還是 CdmaCellLocation
// // 最后 根據你的業務 需求 實現你的代碼
//
// }
// };


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM