Android Question AU.startActivitywithResult

RonkyOne

Member
Licensed User
Longtime User
Hi everyone,
I'm trying to get a response from a call via INTENT

B4X:
Dim intent1 As Intent
        intent1.Initialize("com.xxxxxx.action.xxxxxxxxxxx", "xxxxxxxxx://xxxxx.com/0/")
        intent1.SetPackage("com.xxxxx.xxxxx")
        intent1.AddCategory("android.intent.category.DEFAULT")
   
        AU.startActivitywithResult(intent1)

B4X:
Sub Activity_OnResult(ResultCode As Int, ReturnIntent As Intent)
    Log("result....:")
    Log(ResultCode & " " & ReturnIntent.ExtrasToString)
    If ResultCode = 0 Then Return
     
End Sub

the call seems to work but does not go through
Activity_OnResult



please,
How can I read the received message?
 
Last edited:

drgottjr

Expert
Licensed User
Longtime User
2 questions:
1) do you know for sure that the called package is supposed to return a result (via setresult())?
2) what is AU.startActivitywithResult()? presumably some modified version of @Erel's StartActivityForResult()? mixing and matching may be an issue.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
there is a much more recent "library" available, written by @Erel
https://www.b4x.com/android/forum/t...ivityforresult-with-javaobject.40374/#content
it works quite well. it's hard to know what problems - if any - there may be with something written 10 years ago.
much has changed since then. you might want to try @Erel's example.

if, in fact, the library you currently use does work, then there is still the matter of setResult().
you say you're sure values are returned from the activity that was started by the intent.
if that is the case, then the error resides in code that was not posted.

can you show code or documentation relating to how the called activity returns values to
the caller? i use startactivityforresult daily. in general, 3rd party apps don't expect to be
started for result. those that do will refer to this in their documentation. if you wrote that
other activity, then i'm sure you would know how setresult was handled. please show it.

i find your starting intent a little unusual: normally you would pass parameters with the intent.
i see none in this case. how does the called package know what you want? and exactly
what kind of value or values are you expecting back since the caller specifies nothing?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…