This is what I have so far. small server, created in service.
problem is handling the response, because I must start intent based on the received message in the request.
and in main I have testing sub that starts an intent
I read that I can not call intent from a service, so I have to do it like this.
In Postman, the request is waiting as long as the code gets to the line
Wait For (rs) Complete (Result As Object)
How can I wait for intent response and send it back wia response?
Code is based on Erel's example somewhere from the forum. In my case, I do not have to use RINGTONE_PICKER but third-party app. That went OK and I'm able to get an intent response, but sending it back is problem.
problem is handling the response, because I must start intent based on the received message in the request.
B4X:
Sub HandleMainPage (Response As ServletResponse)
Dim rs As ResumableSub = CallSub(Main,"Testing")
If rs.IsInitialized Then
Wait For (rs) Complete (Result As Object)
Log("AFTER WAITING")
Response.SetContentType("text/html")
Response.SendString("<b>its ok</b>")
Else
Log("Activity was paused")
End If
and in main I have testing sub that starts an intent
B4X:
Dim in As Intent
in.Initialize("android.intent.action.RINGTONE_PICKER", "")
in.PutExtra("android.intent.extra.ringtone.TYPE", 1)
Dim ActivityForResult As StartActivityForResult
ActivityForResult.Initialize("Ion")
ActivityForResult.Start(in,100)
Log("wwww1")
Dim intent_result As Object
Wait For Ion_OnActivityResult (RequestCode As Int, ResultCode As Int, Data As Intent, ExtraParams() As Object)
If ResultCode = StartActivityForResult.RESULT_OK And RequestCode = 100 Then
.
.
I read that I can not call intent from a service, so I have to do it like this.
In Postman, the request is waiting as long as the code gets to the line
Wait For (rs) Complete (Result As Object)
How can I wait for intent response and send it back wia response?
Code is based on Erel's example somewhere from the forum. In my case, I do not have to use RINGTONE_PICKER but third-party app. That went OK and I'm able to get an intent response, but sending it back is problem.
Last edited: