문제

My employer gave me a femto-cell and currently i am trying to figure if my galaxy-nexus can access the femtocell. As i cant force my phone to use this specific cell and it automatically always uses just available macro-cells, i have trouble to figure if the femtocell is present at all.

Here is what i tried so far. But it always returns null, which means in android-docs that my device isnt capable of using CellInfo-methods.

telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
List<CellInfo> cellInfo = telephonyManager.getAllCellInfo();  // returns null
List<NeighboringCellInfo> cellInfo = telephonyManager.getNeighboringCellInfo(); // returns null

then

 telephonyManager.getPhoneType(); // returns PHONE_TYPE_GSM

aswell i found this quote in another post:

Conclusion: getting information about nearby cells on Android is pretty messy business at the moment. You may need to use a combination of all three methods to get the information you want, and even that way, some things may be inaccessible.

What might be the third option? Does anyone have a conclusion for a galaxy nexus? Does anyone have another idea how i could detect the availabilty of the femto_cell? it is driving me mad :/

도움이 되었습니까?

해결책

Use CellLocation to find the cell id(base station ID).

Try something like this

TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
CellLocation cl = tm.getCellLocation();
GsmCellLocation gsmLoc;
CdmaCellLocation cdmaLoc;
try {
    gsmLoc = (GsmCellLocation) cl;
    System.out.println("Cell id " + gsmLoc.getCid());
    System.out.println("Lac - " + gsmLoc.getLac());
    System.out.println("Psc - " + gsmLoc.getPsc());
} catch (ClassCastException e) {
    cdmaLoc = (CdmaCellLocation) cl;
    System.out.println("Base station ID - "+ cdmaLoc.getBaseStationId());
    System.out.println("Base station Latitude - "+ cdmaLoc.getBaseStationLatitude());
    System.out.println("Network Id - "+ cdmaLoc.getNetworkId());
    System.out.println("System ID -"+ cdmaLoc.getSystemId());
}
System.out.println("Operator Name - "+ tm.getNetworkOperatorName());

I tested using Verizon's network extender and the operator name returned is "Network Extender".

I used Samsung Note 3. A "home" icon displayed on the status bar When connected to femto cell.

다른 팁

Especially on older phones getAllCellInfo() is not always supported. Try to use the old methods for retrieving cell information of the connected base station:

TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
GsmCellLocation cellLocation = (GsmCellLocation) telephonyManager.getCellLocation();
int cellid = cellLocation.getCid();
...

Unfortunately, there is no way to get the neighboring cells on a Samsung device. In my experience you get best results (and working getAllCellInfo()) with current LG phones.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top