Modificacion del GPS 4.10.10

This commit is contained in:
cvaldes1201
2024-10-14 12:32:21 -06:00
parent 208a7c4b98
commit 618966b8b5
6 changed files with 46 additions and 11 deletions

View File

@@ -35,6 +35,7 @@ Sub Class_Globals
Dim device As Phone
Dim MES1 As ManageExternalStorage
Dim x As Int = 0
Dim GPS As GPS
'Datos generales
Private l_nombreg As Label
Private l_rfc As Label
@@ -147,7 +148,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
p_w3.Visible = False
p_camara.Width = Root.Width
p_camara.Height = Root.Height
GPS.Initialize("GPS")
ScrollView1.height = Root.Height - Panel1.Height -WobbleMenu1.Height
p_w1.height = Root.Height - Panel1.Height -WobbleMenu1.Height
@@ -257,7 +258,33 @@ Private Sub B4XPage_Created (Root1 As B4XView)
End Sub
Private Sub B4XPage_Appear
If GPS.GPSEnabled=False Then
Dim Resultado As Int= -3
Do While Resultado=-3
Resultado = Msgbox2("Habilitar el GPS", "Atencion","ACEPTAR","", "",LoadBitmap(File.DirAssets,"alert2.png"))
Select Case Resultado
Case DialogResponse.POSITIVE
MsgboxAsync("Habilitar el GPS", "Atencion")
StartActivity(GPS.LocationSettingsIntent)
Case DialogResponse.NEGATIVE
B4XPage_Appear
End Select
Loop
Else
' Log("ENTRE")
StartService(Tracker)
' m_lat = "0"
' m_lon = "0"
GPS_LocationChanged(Tracker.FLP.GetLastKnownLocation)
End If
WobbleMenu1.SetCurrentTab(1)
p_w1.Visible = True
parentesco = ""
@@ -2181,7 +2208,13 @@ Private Sub B4XPage_CloseRequest As ResumableSub
End Sub
Sub GPS_LocationChanged (Location1 As Location)
' LogColor($"Entrando a Cliente.GPS_LocationChanged"$, Colors.red)
If Tracker.FLP.GetLastKnownLocation.IsInitialized And Tracker.FLP.GetLastKnownLocation.Latitude <> 0 Then
Starter.latitud = Tracker.FLP.GetLastKnownLocation.Latitude
Starter.longitud= Tracker.FLP.GetLastKnownLocation.Longitude
' Log("Coords set to: " & B4XPages.MainPage.lat_gps & " and " & B4XPages.MainPage.lon_gps)
End If
CallSubDelayed(Tracker, "CreateLocationRequest")
' ubicacion.Initialize
' ubicacion.Latitude = mlat
' ubicacion.Longitude = mlon
@@ -2198,6 +2231,5 @@ Sub GPS_LocationChanged (Location1 As Location)
'' Log(Starter.latitud & " , " & Starter.longitud)
' l_ubicacion.Text = $"Dist: $1.0{distance} mts."$
' If laDist > 50 Then l_ubicacion.TextColor = Colors.Red Else l_ubicacion.TextColor = Colors.Blue
Starter.longitud = Location1.Longitude
Starter.latitud = Location1.Latitude
Log(Starter.longitud &" "& Starter.latitud)
End Sub