Hi, I made a service that will record the location then upload it to a server. The code I made keeps crashing, anyone know why?
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim ListData As List
Dim FTP As FTP
Dim GPS1 As GPS
Dim Lat As String
Dim Lon As String
End Sub
Sub Service_Create
GPS1.Initialize("GPS")
GPS1.Start(60000, 5)
End Sub
Sub Service_Start (StartingIntent As Intent)
End Sub
Sub GPS_LocationChanged (Location1 As Location)
Lat = Location1.ConvertToMinutes(Location1.Latitude)
Lon = Location1.ConvertToMinutes(Location1.Longitude)
ListData.Set(3, "Latitude=" & Lat)
ListData.Set(4, "Longitude=" & Lon)
File.WriteList(File.DirInternal, "userdata.txt", ListData)
CallSub(Main, "DBUpload")
End Sub
Sub GPS_UserEnabled (Enabled As Boolean)
End Sub
Sub Service_Destroy
End Sub