private static void processCellInfos(List<CellInfo> cellInfos){
if(cellInfos != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
for(CellInfo cellInfo : cellInfos){
if(cellInfo instanceof CellInfoWcdma){
final CellInfoWcdma cellInfoWcdma = (CellInfoWcdma) cellInfo;
sendCallback(PluginResult.Status.OK,
JSONHelper.cellInfoWCDMAJSON(cellInfoWcdma, _returnSignalStrength));
}
if(cellInfo instanceof CellInfoGsm){
final CellInfoGsm cellInfoGsm = (CellInfoGsm) cellInfo;
sendCallback(PluginResult.Status.OK,
JSONHelper.cellInfoGSMJSON(cellInfoGsm, _returnSignalStrength));
}
if(cellInfo instanceof CellInfoCdma){
final CellInfoCdma cellIdentityCdma = (CellInfoCdma) cellInfo;
sendCallback(PluginResult.Status.OK,
JSONHelper.cellInfoCDMAJSON(cellIdentityCdma, _returnSignalStrength));
}
if(cellInfo instanceof CellInfoLte){
final CellInfoLte cellInfoLte = (CellInfoLte) cellInfo;
sendCallback(PluginResult.Status.OK,
JSONHelper.cellInfoLTEJSON(cellInfoLte, _returnSignalStrength));
}
Log.d(TAG,cellInfo.toString());
}
}
else {
Log.e(TAG, "CellInfoLocation returning null. Is it supported on this phone?");
// There are several reasons as to why cell location data would be null.
// * could be an older device running an unsupported version of the Android OS
// * could be a device that doesn't support this capability.
// * could be incorrect permissions: ACCESS_COARSE_LOCATION
sendCallback(PluginResult.Status.ERROR,
JSONHelper.errorJSON(CELLINFO_PROVIDER, ErrorMessages.CELL_DATA_IS_NULL()));
}
}
CellLocationController.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:localcloud_fe
作者:
评论列表
文章目录