Android Question JavaObject Question

hzchrisfang

Member
Licensed User
Longtime User
This class by itself is not useful.

You can get this data with this library: http://www.b4x.com/android/forum/threads/phonestatelistener.12377/

Hello Erel, Thanks for your reply.

I had learned about PhoneStateListener library and I can get the Cellinfo and SignalStrength of the current cell through this library successfully, but I need more data about NeighboringCellInfo , this seems not included in the library.

I use TelephonyManager.getAllcellInfo by JavaObject , code:
B4X:
Oblist = Obj.RunMethodJO("getAllCellInfo", Null)
Dim ObjPri As JavaObject = Oblist.Get(0)
Dim ObjPriInfo As JavaObject = ObjPri.RunMethod("getCellIdentity",Null)
Dim ObjPriSgn As JavaObject = ObjPri.RunMethod("getCellSignalStrength",Null)

In this way, I hope to get information of all cells. But in fact, I got the result about CellIdentity and CellSignalStrength, CellIdentity result is correct, but the value of signalstrength is incorrect, the log is :

(CellSignalStrengthCdma) CellSignalStrengthCdma: cdmaDbm=2147483647 cdmaEcio=2147483647 evdoDbm=0 evdoEcio=0 evdoSnr=0

In this mean,I think I can not get the signalstrength value of neighbour cell by TelephonyManager API, so I want to test other similar APIs.

Can you give me some advice about this question?
 
Last edited:
Upvote 0

hzchrisfang

Member
Licensed User
Longtime User
2147483647 is the maximum value for int values. It probably represents an unknown value.

But when use PSL.CDMAdbm and PSL.EVDOdbm in PhoneStateListener library I can get the correct value of cell signal, so what has gone wrong probably in my case?
 
Upvote 0

hzchrisfang

Member
Licensed User
Longtime User
The code in post #3.

my code:
B4X:
    Dim Oblist As List
    Dim Obj As JavaObject = GetContext.RunMethod("getSystemService", Array("phone"))
    Oblist = Obj.RunMethodJO("getAllCellInfo", Null)
    Dim ObjPri As JavaObject = Oblist.Get(0)
    Dim ObjPriInfo As JavaObject = ObjPri.RunMethod("getCellIdentity",Null)
    Dim ObjPriSgn As JavaObject = ObjPri.RunMethod("getCellSignalStrength",Null)
    Log(ObjPriSgn)
 
Upvote 0

hzchrisfang

Member
Licensed User
Longtime User
What is the size of Oblist? Maybe there is more information in the list.

If device received signal from several cells, the size of Oblist is the counts of those cells, Oblist(0) contain the information of current cell, include CellIdentity and CellSignalStrength. If size>1, for example, size=2, then Oblist(1) contain the information of a neighbour cells.
 
Upvote 0
Top