Android Question Intent response or onActivityResult?

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
This is my first time trying intents, so please be gentle with me ;)

I'm trying to get a response from another (not my app) activity that I start with an intent, but when my app resumes the intent extras is empty and the Intent.GetData is null.

I know the intent is being handled correctly as I see the activity I am starting show up, and my app resumes when it closes. Their example test app seems to communicate with their app just fine. It's a pretty simple request:
B4X:
Dim poIn As Intent
poIn.Initialize("com.whateverapp.action.REQUEST", "")
poIn.PutExtra("Extra_1", "Some Data")
poIn.PutExtra("Extra_2", 5)
StartActivity(poIn)

Is there something I need to add to the manifest to see the response? The app's SDK says it can, "return a response as a string from the "response" extra of the onActivityResult" but I don't see an event prototype for that in the Intellisense for the Activity subs.

Any direction to look would be helpful, thanks!
 

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
One question, though...

I'm trying to encapsulate the app-to-app intents within a class and in your example you linked, you're accessing the Activity object and sinking the event back to that, is there any way to handle this internally in a class or must it be housed in an Activity?
 
Upvote 0

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
Ok, I lied, two more questions ;)

The second question being, when my activity restarts in the Activity_Resume event how can I tell if my app is restarting because the user launched it or I'm waiting for the "ion_Event to fire? There does not appear to be any way to detect this via the resume's intent. Am I going to have to write a state file to disk and hope the other app actually does fire the "ion_Event" at some point?
 
Upvote 0

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
Perfect, that tells me what I need to know.

I will use the activity events to sink back to the class and I had incorrectly assumed the Activity_Resume would fire first.

Thanks again!
 
Upvote 0
Top