Jeffrey Cameron Well-Known Member Licensed User Longtime User May 27, 2016 #1 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: Code: Copy 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!
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: Code: Copy 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!
Erel B4X founder Staff member Licensed User Longtime User May 29, 2016 #2 Go over this tutorial: Using StartActivityForResult with JavaObject Upvote 0
Jeffrey Cameron Well-Known Member Licensed User Longtime User May 31, 2016 #3 That was exactly what I needed, thanks Erel! Upvote 0
Jeffrey Cameron Well-Known Member Licensed User Longtime User May 31, 2016 #4 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
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?
Jeffrey Cameron Well-Known Member Licensed User Longtime User May 31, 2016 #5 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
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?
Erel B4X founder Staff member Licensed User Longtime User Jun 1, 2016 #6 It should be called from the Activity. ion_Event will be called before Activity_Resume. You can use a global flag that is set in ion_Event and checked in Activity_Resume. Upvote 0
It should be called from the Activity. ion_Event will be called before Activity_Resume. You can use a global flag that is set in ion_Event and checked in Activity_Resume.
Jeffrey Cameron Well-Known Member Licensed User Longtime User Jun 1, 2016 #7 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
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!