Hi,
I am trying to receive some data via intent from a character reading application via camera.
I am trying to use this code:
But the data coming back is always null, the remote application starts and recognizes the passed parameters as extra.
The data in the example is not real but I just want only to understand if the procedure I use is correct.
I've tried both 'Receiver_receive' and 'StartActivityForResult' but I think I got a little confused.
Many thanks in advance.
Paolo
I am trying to receive some data via intent from a character reading application via camera.
I am trying to use this code:
B4X:
' *********************************************
Sub startVideoProcessing
Dim i As Intent
i.Initialize("android.intent.action.ACTION_VIEW", "")
i.SetComponent("com.clientwithopencv/.activities.MainActivity")
Dim Settings As Map
Settings.Initialize
Settings.Put("location", "ITA")
Settings.Put("servicePath", "https://api.cloud.com/start")
Settings.Put("apiKey", "API KEY")
Dim jsonGen As JSONGenerator
jsonGen.Initialize(settings)
Dim jsonSettings As String = jsonGen.ToString
i.PutExtra("settings", jsonSettings)
jsonGen.Initialize(carmenSettings)
Dim ActivityForResult As StartActivityForResult
ActivityForResult.Initialize("Ion")
ActivityForResult.Start(i,100)
End Sub
' *********************************************
Sub Activity_Resume
'Log(Activity.GetStartingIntent) =
(Intent) Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=it.myname.package cmp=it.myname.package/.main }
Dim in As Intent
in = Activity.GetStartingIntent '
If in <> Null Then
If in.HasExtra("Settings") Then
End If
End If
End Sub
' *********************************************
Private Sub Ion_OnActivityResult (RequestCode As Int, ResultCode As Int, Data As Intent, ExtraParams() As Object)
'RequestCode=100
'ResultCode=0
'Data=Not initialized
'ExtraParams=null
If ResultCode = StartActivityForResult.RESULT_OK And RequestCode = 100 Then
'*not real parameters, only for test, anyway don't reach this code*
Dim jo As JavaObject = Data
Dim uri As String = jo.RunMethod("getParcelableExtra", Array As Object("android.intent.extra.ringtone.PICKED_URI"))
Log(uri)
End If
End Sub
But the data coming back is always null, the remote application starts and recognizes the passed parameters as extra.
The data in the example is not real but I just want only to understand if the procedure I use is correct.
I've tried both 'Receiver_receive' and 'StartActivityForResult' but I think I got a little confused.
Many thanks in advance.
Paolo