Android Question GetCellLocation with threading

sotik

Member
Licensed User
Longtime User
Hi all,

i need to do an asynchronous task to get the CellLocation few times while the app is running, i have the next code:

Public Sub Initialize
th.Initialise("thread")

th.Start(Me,"Task_Location",Null)



End Sub

Sub Task_Location

Dim Obj1 As Reflector
Dim cid, lac As Int
Dim Location As String
Dim n As Long
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
Do While True
Log("getting location...")
Location = BGCell.getCellLocation(cid,lac) & " "

n = Location.IndexOf(",")
If n>0 Then
Main.latitude = Location.SubString2(0,n)
Main.altitude = Location.SubString2(n+1,Location.Length).trim
Else

Main.latitude = "0"
Main.altitude = "0"
End If
Log("Position: " &Main.latitude&"|"&Main.altitude)
th.Sleep(10000)
Loop

End Sub

This doesn't work, any help?
 

sotik

Member
Licensed User
Longtime User
No, if you can tell me the name of one of them or more i would be grateful.
I need get location without use GPS.
 
Last edited:
Upvote 0
Top