Android Question LocationChanged Event not Fire

Anuj_Singh

Member
Licensed User
Longtime User
I am trying to execute following code, but Location_LocationChanged event wont fire.
That's why i m not able to get Latitude & Longitude.

Please help

'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.

Dim Location As LocationManager

Dim LabelLat As Label
Dim LabelLon As Label
Dim WebView1 As WebView
Dim xLatitude As Double
Dim xLongitude As Double

Dim ScaleLat, ScaleLong, Scale_Distance As Double
Dim TileWidth, TileHeight As Int
Dim ZoomLevel As Int

Type CoordLongLat(Lng As Double, Lat As Double)
Dim CenterLonLat As CoordLongLat
Dim DispMapTypeControl As Boolean : DispMapTypeControl = True
Dim DispMapScaleControl As Boolean : DispMapScaleControl = True
Dim DispMapZoomControl As Boolean : DispMapZoomControl = True
Dim DispMapCenterMarker As Boolean : DispMapCenterMarker = True
Dim DispMapMarkers As Boolean : DispMapMarkers = True
Dim DispMapPolyline As Boolean : DispMapPolyline = False
Dim Http As HttpClient
Dim Label1 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)

Location.Initialize("Location")
Activity.LoadLayout("latlontest")

ZoomLevel = 15

End Sub

Sub Activity_Resume
Location.requestMobileLocation ' .requestLocation
End Sub

Sub Activity_Pause (UserClosed As Boolean)
Location.stopMobileListening
End Sub


Sub Location_LocationChanged (Longitude As Double, Latitude As Double, Altitude As Double, Accuracy As Float, Bearing As Float, Provider As String, Speed As Float, Time As Long)
LabelLat.Text=Latitude
LabelLon.Text=Longitude
xLatitude=Latitude
xLongitude=Longitude
Label1.Text=Accuracy
'PosLat.Clear
'PosLng.clear
'PosLat=41.581539
'PosLng=1.998829
ShowMap
'ToastMessageShow("Long: " & Longitude & " - Lat: " & Latitude,True)
'ToastMessageShow("Long: " & Longitude & " - Lat: " & Latitude,True)
'ToastMessageShow("Long: " & Longitude & " - Lat: " & Latitude,True)

End Sub
 
After activating mobiles inbuilt Navigation Application, then Location.requestGPSLocation starts giving Latitude & Longitude.
What's going wrong please advise.
 
Upvote 0
I got 4 Satellites some time 6 but still it wont shows Latitude & Longitude.
Attached is screen shot.
 

Attachments

  • GpsScreen.png
    GpsScreen.png
    93.7 KB · Views: 390
Upvote 0
Back
Top