tengo un tema con un servicio GPS, este servicio se inicia con la aplicación, pero queda activo(se supone jaja) el tema es que una vez iniciada la aplicación, no siempre esta transmite su posición...
este es el código que uso...
el job que ocupo es el mismo que uso en otras aplicaciones para insertar los datos del GPS y funciona perfecto.
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			este es el código que uso...
el job que ocupo es el mismo que uso en otras aplicaciones para insertar los datos del GPS y funciona perfecto.
			
				B4X:
			
		
		
		Sub Process_Globals
    Dim GPS1 As GPS
   
    Dim Job1 As HttpJob
    Dim timer1 As Timer
    Dim SentenceUtils As String
       Dim AuxSentece As String
   
End Sub
Sub Service_Create
GPS1.Initialize("GPS")
If GPS1.GPSEnabled = False Then
        ToastMessageShow("Please enable the GPS device.", True)
        StartActivity(GPS1.LocationSettingsIntent) 'Will open the relevant settings screen.
End If
timer1.Initialize("Timer1",120000)
End Sub
Sub GPS_LocationChanged (Location1 As Location)
   
End Sub
Sub GPS_NMEA (TimeStamp As Long, Sentence As String)
   
       If Sentence.Contains("GPRMC") = True Then
           timer1.Enabled = True
        AuxSentece = Sentence
    End If
End Sub
Sub Service_Start (StartingIntent As Intent)
      StartServiceAt("", DateTime.Now + 120 * 1000,True)
    
      ToastMessageShow("Turning GPS ON", True)
   
     
      GPS1.Start(0,0) 
End Sub
Sub Timer1_Tick
    Dim su As StringUtils
   
   
    SentenceUtils = su.EncodeUrl(AuxSentece,"UTF8")
   
    Job1.Initialize("Job1",Me)
    Job1.Download("http://www.xxx.cl:8080/gprmc/Data?acct=estampa&dev=" & Main.PatenteGbl & "&gprmc=" & SentenceUtils)
    'End If
   
    
End Sub
Sub Service_Destroy
End Sub
   
Sub JobDone (Job As HttpJob)
   Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
   If Job.Success = True Then
      Select Job.JobName
         Case "Job1", "Job2"
            'print the result to the logs
            Log(Job.GetString)
      End Select
   Else
      Log("Error: " & Job.ErrorMessage)
      ToastMessageShow("Error: " & Job.ErrorMessage, True)
   End If
   Job.Release
End Sub 
				 
 
		 
 
		 
 
		 
 
		