I have implemented the following code to interact with a Intent for POS system. It does execute correctly but it always returns arg(0) = 0 and I dont get back the data needed.
It returns a string with a JSON inside allways
This is based on the example from the documentation :
The documentation presents the following as the result for the above code and get the string data expected:
The service is called based on the B4A that I implemented, however there is no useful return. I get a arg(0) = 0 and arg(1) = null.
I need to retrieve the result
It returns a string with a JSON inside allways
B4X:
Private Sub ButtonAtivar_Click
Dim stringTransacao As String
Dim m As Map
m.Initialize
m.Put("operacao", "ativar")
m.Put("documento", "21.333.xxx/xxxx-xx")
Dim json As JSONGenerator
json.Initialize(m)
stringTransacao = json.ToString
Dim pac As PackageManager
Dim in As Intent
in=pac.GetApplicationIntent("br.com.destaxa.destaxapay")
in.PutExtra("transacao", stringTransacao)
StartActivityForResult(in)
End Sub
private Sub ion_Event (MethodName As String, Args() As Object) As Object
If Args(0) = 0 Then
??????
End If
Return Null
End Sub
This is based on the example from the documentation :
B4X:
Intent mDestaxaPay = new Intent();
mDestaxaPay.setClassName("br.com.destaxa.destaxapay",
"br.com.destaxa.destaxapay.TransactionActivity");
String stringTransaction = sdkTransaction.toString();
mDestaxaPay.putExtra(“transacao”, stringTransaction);
startActivityForResult(mDestaxaPay, PROCESS_TRANSACTION);
The documentation presents the following as the result for the above code and get the string data expected:
B4X:
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data){
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PROCESS_TRANSACTION && resultCode == RESULT_OK) {
try {
JSONObject response = new JSONObject(data.getStringExtra(“resposta”));
processResponse(response);
} catch (JSONException e) {
}
}
}
The service is called based on the B4A that I implemented, however there is no useful return. I get a arg(0) = 0 and arg(1) = null.
I need to retrieve the result
Last edited: