Cell Tower CellID

larrytango

Member
Licensed User
Longtime User
Hello , im wishing to make an app that will do things based on what cell tower im connected to , is it possible using b4a to get the current cellid?
 

jkurant

Member
Licensed User
Longtime User
I don't understand where this Reflection library is found. And I can't find a list of all libraries.

How do I get it? I would like to use this code.
 
Upvote 0

KY Leng

Member
Licensed User
Longtime User
You should be able to do it quite simply with my Reflection library. Something like this though I haven't actually tried it. CellId and Lac only exist for GSM networks.
B4X:
Dim Obj1 As Reflector
Dim cid, lac As Int
Obj1.Target = Obj1.GetContext
Obj1.Target = Obj1.RunMethod2("getSystemService", "phone", "java.lang.String")
Obj1.Target = Obj1.RunMethod("getCellLocation") ' get a GsmCellLocation
cid = Obj1.RunMethod("getCid") ' gsm cell id
lac = Obj1.RunMethod("getLac") ' gsm location area code
I have test your code and it work for 3G as well. However, the CID and LAC is something like this for my country (Cambodia) CID=207457, LAC=30001 (in decimal format).
But how to get the MCC and MNC from your library?
 
Upvote 0
Top