On Android 13, this code does not work.
I send the post to the page but for some reason, it stops obtaining the answer for server on android 13. All previous Android versions work perfectly.
Can anyone help?
I send the post to the page but for some reason, it stops obtaining the answer for server on android 13. All previous Android versions work perfectly.
Can anyone help?
B4X:
Dim xml As String
Dim p As Phone
Dim str_id As String
Dim str_fabricante As String
Dim str_Modelo As String
' Comando
comando_em_curso = 3
Dim HttpRequestClass As OkHttpRequest
Dim HttpClientClass As OkHttpClient
'
' Tem ligação à internet?
'
If rotinas.CheckConnection = False Then
Return
End If
'Android_ID do equipamento
str_id = p.GetSettings("android_id")
str_fabricante = p.Manufacturer
str_Modelo = p.Model
xml = "<LIC>"
xml = xml & "<SO>Android</SO>" ' Sistema operativo (SO)
xml = xml & "<VO>" & rotinas.GetSDKversion & "</VO>" ' Versão Do sistema operativo (VO)
xml = xml & "<CA>" & "</CA>" ' Chave actual de ativação (CA) ChaveActivacaoPOS
xml = xml & "<TL>12</TL>" ' Tipo de licença (TL) - 12 meses
xml = xml & "<CP>PT</CP>" ' Código Do pais (CP)
xml = xml & "<NE>" & lic_Designacao & "</NE>" ' Nome da empresa (NE)
xml = xml & "<CC>" & lic_Contribuinte & "</CC>" ' Contribuinte (CC)
xml = xml & "<NC>" & lic_NomeContacto & "</NC>" ' Nome Do contacto (NC)
xml = xml & "<TC>" & lic_Telemovel & "</TC>" ' Telefone (TC)
xml = xml & "<EM>" & lic_Email & "</EM>" ' Email (EM)
xml = xml & "<ID>" & str_id & "</ID>" ' ID Do equipamento (ID)
xml = xml & "<FB>" & str_fabricante & "</FB>" ' Fabricante Do aparelho (FB)
xml = xml & "<MD>" & str_Modelo & "</MD>" ' Modelo Do equipamento (MD)
xml = xml & "<PR>40</PR>" ' Produto 486TAXI (PR)
xml = xml & "<NP>" & CodigoPedido & "</NP>" ' Numero Do pedido (NP)
xml = xml & "<OP>2</OP>" ' Operação 1=Requer, 2=Cancela (OP)
xml = xml & "</LIC>"
HttpClientClass.InitializeAcceptAll("HttpClientClass")
HttpRequestClass.InitializePost2("https://486invoice.com/zzzzzzzzzzzzzzz.php", xml.GetBytes("UTF8"))
HttpRequestClass.SetHeader("Content-Type", "text/xml; charset=utf-8")
HttpRequestClass.Timeout = 500000
Log("Vou fazer o HttpClientClass.Execute")
HttpClientClass.Execute(HttpRequestClass, 5000)
End Sub
Sub HttpClientClass_ResponseError (Response As OkHttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
Msgbox("Erro nas comunicações: " & Reason,Main.pg_486software)
End Sub
Sub HttpClientClass_ResponseSuccess (Response As OkHttpResponse, TaskId As Int)
Log("out_httpClasse_ResponseSuccess")
out_httpClasse.InitializeToBytesArray(0)
Response.GetAsynchronously("res", out_httpClasse, False, TaskId)
End Sub
Sub res_StreamFinish (Success As Boolean, TaskId As Int)
Dim resultSoapXML As String
Dim novo_prefixo As String
Dim xletra As String
Dim letras_permitidas As String
Dim sql_txt As String
Dim rs As Cursor
Dim tem_movimentos As Int
Dim xusr As cls_Utilizador
Dim xcod As String
Dim tem_pontes As Int
Dim cod_taxa_iva As Int
Dim xart_ponte As cls_Artigo
resultSoapXML=""
Log("res_StreamFinish success:" & Success)
If Success Then
resultSoapXML = BytesToString(out_httpClasse.ToBytesArray, 0, out_httpClasse.ToBytesArray.Length, "utf8")
out_httpClasse.close
Msgbox(resultSoapXML,"Resposta:")
AND NOW, resultSoapXML IS EMPTY!!! WHY?