GetAllCellInfo () returns empty list in Huawei Honor 7

I have an Android app that retrieves information about cell towers. I am using this getAllCellInfo () to retrieve information about the primary cell and neighboring cells. I have enabled ACCESS_COARSE_LOCATION permission on manifest.xml and made a runtime permission request. It works in other phones, but in Huawei Honor 7, the function returns an empty list.
 
My code: Catlog:
enter image description here
enter image description here

I've checked other questions: getAllCellInfo returns null in android 4.2.1 and Android getAllCellInfo () returns null .

From the question I was thinking about Huawei phones, they don't support getAllCellInfo () until I installed Network Cell Info Lite and NetMonster , and it seems that apps can get cell information in Huawei Honor 7:

Network Cellular Information Lite NetMonster
enter image description here

enter image description here

Anyone have any information on this?

+3


source to share


1 answer


For a little work when there is getAllCellInfo()

no cell in, I use getCellLocation()

to get the primaryCellId and trackingAreaCode like this:



    Log.d(TAG, "updateCurrentCell: can't find any cells with getAllCellInfo");
    CellLocation primaryLocation = telephonyManager.getCellLocation();
    if (primaryLocation != null) {
        int primaryCellId = Integer.parseInt(primaryLocation.toString().split(",")[1]);
        int trackingAreaCode = Integer.parseInt(primaryLocation.toString().split(",")[0].replace("[", ""));
    } else {
        Log.d(TAG, "updateCurrentCell: not even with getCellLocation");
    }

      

+2


source







All Articles