80,351
社区成员
发帖
与我相关
我的任务
分享
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
// 最后 根据你的业务 需求 实现你的代码
}
};