Android Question Web Service

Rodrigo Ramirez C

Member
Licensed User
Hi , I'm new and I can not control the completion of the web service to continue the implementation of the relevant code , how I can help .
Deputy program code
Thank you very much

Sub Activity_Create(FirstTime As Boolean)
Validacion.Initialize
V_IMEI = Validacion.Obt_IMEI
Msgbox("Activity Create","msg")
Activity.LoadLayout("L_Main")
Telefono.SetScreenOrientation(1)
Activity.Title = V_TituloApp
LB_Mensaje.Text = V_CopyRigth

ImageView1.Initialize ("")
ImageView1.Gravity = Gravity.Fill
ImageView1.Bitmap = LoadBitmap(File.DirAssets, V_Logo)
Activity.AddView (ImageView1, 36dip, 10dip, 275dip, 165dip)

End Sub

Sub Bt_Continuar_Click

If (LB_Correo.Text <> "") And (LB_Password.Text <> "") Then
Dim JSONGenerator As JSONGenerator
Dim JSONList As List
Dim ZeileMap As Map
Dim JSONString As String
Dim J1 As HttpJob

JSONList.Initialize
ZeileMap.Initialize
ZeileMap.Put("Correo",LB_Correo.Text)
ZeileMap.Put("Contrasena",LB_Password.Text)
ZeileMap.Put("IMEI",V_IMEI)
LB_Correo.Text = ""
LB_Password.Text = ""
JSONList.Add(ZeileMap)
JSONGenerator.Initialize2(JSONList)
JSONString = JSONGenerator.ToString
J1.Initialize("J1","Main")
J1.postString("http://190.147.169.138:81/autenticacion", JSONString)
Else
Msgbox("Correo o Contraseña vacios","Alerta")
End If

End Sub

Sub JobDone (J1 As HttpJob)

Dim Convertidor As JSONParser
Dim Cadena As String
Dim Resultado As String
Dim Lista As List
Dim Map As Map

If J1.Success Then
Cadena = J1.GetString
Convertidor.Initialize(Cadena)
Lista.Initialize
Lista = Convertidor.NextArray
Map = Lista.Get(0)
Resultado = Map.Get("Estado")
If (Resultado = "SI") Then
V_CodComercial = Map.Get("CodSales")
V_NameSales = Map.Get("NombreSales")
V_Mensaje = Map.Get("MensajeSales")
If DateTime.GetHour(DateTime.Now) < 12 Then
ToastMessageShow("Buenos Días", False)
Else
ToastMessageShow("Buenas Tardes", True)
End If
StartActivity(Menu)
Else
Msgbox("Verifique correo y/o contraseña o equipo no asignado", "Alerta")
End If
Else
Msgbox(J1.ErrorMessage, "Error")
End If
J1.Release
End Sub
 

eurojam

Well-Known Member
Licensed User
Longtime User
please use Code tags for your code
Image1.jpg
 
Upvote 0

Rodrigo Ramirez C

Member
Licensed User
B4X:
Sub Activity_Create(FirstTime As Boolean)
 
    Validacion.Initialize
    V_IMEI = Validacion.Obt_IMEI
    Msgbox("Activity Create","msg")
    Activity.LoadLayout("L_Main")
    Telefono.SetScreenOrientation(1)
    Activity.Title = V_TituloApp
    LB_Mensaje.Text = V_CopyRigth

    ImageView1.Initialize ("")
    ImageView1.Gravity = Gravity.Fill
    ImageView1.Bitmap = LoadBitmap(File.DirAssets, V_Logo)
    Activity.AddView (ImageView1, 36dip, 10dip, 275dip, 165dip)
 
End Sub

Sub Bt_Continuar_Click

    If (LB_Correo.Text <> "") And (LB_Password.Text <> "") Then 
       Dim JSONGenerator As JSONGenerator
       Dim JSONList As List
         Dim ZeileMap As Map
       Dim JSONString As String
       Dim J1 As HttpJob
 
       JSONList.Initialize
       ZeileMap.Initialize
       ZeileMap.Put("Correo",LB_Correo.Text)
       ZeileMap.Put("Contrasena",LB_Password.Text)
       ZeileMap.Put("IMEI",V_IMEI)
       LB_Correo.Text = ""
       LB_Password.Text = ""
       JSONList.Add(ZeileMap)
       JSONGenerator.Initialize2(JSONList)
       JSONString = JSONGenerator.ToString
       J1.Initialize("J1","Main")
       J1.postString("http://190.147.169.138:81/autenticacion", JSONString)   
    Else
        Msgbox("Correo o Contraseña vacios","Alerta")
    End If

End Sub

Sub JobDone (J1 As HttpJob)
 
    Dim Convertidor As JSONParser
    Dim Cadena As String
    Dim Resultado As String
    Dim Lista As List
    Dim Map As Map
    If J1.Success  Then
       Cadena = J1.GetString
       Convertidor.Initialize(Cadena)
       Lista.Initialize
       Lista = Convertidor.NextArray
       Map = Lista.Get(0)
       Resultado = Map.Get("Estado")
       If (Resultado = "SI") Then
          V_CodComercial = Map.Get("CodSales")
          V_NameSales = Map.Get("NombreSales")
          V_Mensaje = Map.Get("MensajeSales")
          If DateTime.GetHour(DateTime.Now) < 12 Then
               ToastMessageShow("Buenos Días", False)
          Else
               ToastMessageShow("Buenas Tardes", True)
          End If  
          StartActivity(Menu)
       Else
               Msgbox("Verifique correo y/o contraseña o equipo no asignado", "Alerta")
       End If   
    Else
        Msgbox(J1.ErrorMessage, "Error")
    End If
    J1.Release
End Sub
 
Upvote 0
Top