Sub LocationChanged(Location1 As Location)
StopService(LocationMonitor)
Log("LocationChanged at " & DateTime.Time(DateTime.Now))
locationUser = Location1
Check_OnIsland
Check_Geofences
TestUpload(locationUser)
End Sub
Sub TestUpload(x As Location)
Dim lock As PhoneWakeState
lock.PartialLock
Dim s As String
s = "Insert Into geofences (Device_ID, Latitude, Longitude, Geofence_ID, Time_In) Values ('" & appSetting.Get("PhoneID") & "'," & x.Latitude & "," & x.Longitude & ", 'Test', " & DateTime.Now & ")"
Dim job As HttpJob
job.Initialize("", Me)
Dim count As Int = 0
Do While (job.Success = False) And (count < 5)
count = count + 1
Sleep(2000)
job.PostString(sqlServer,s)
Wait For (job) JobDone(job As HttpJob)
If job.Success = False Then
Log("Error" & count & " = " & job.ErrorMessage)
End If
Loop
job.Release
lock.ReleasePartialLock
End Sub