Good morning Android experts! A question about `A...
# android
a
Good morning Android experts! A question about
ActivityResultContracts
Let's say we have ScreenA, ScreenB, ScreenC (inOrder) When user navigates to B, then C and perform some actions, the C is closed with
setResult
, then B (though
ActivityResultLauncer<C>
receives it. And closed itself with it's own
setResult
. Therefore A will receive
result<B>
, and perform some action (notify user about an action. That flow works fine for now... BUT When we receive a deeplink, we parse it on custom router activity, and we launch the stack of intents directly A >> B, so, user as B closes will go to A... The problem we are facing is that. As B has not been launched through
ActivityResultLauncher
from A, A never receives the result when C/B is closed...
A already on stack with it's own Intent()
So.... the question is... Is there a way to "force"
ActivityResultLauncher<B>
to receive results even if not used to launch B?
not kotlin but kotlin colored 3
c
Image from iOS.jpg
j
There is no way to force it. You will have to manually handle your deep links and launch via the callback system if that's what you want to do I'd recommend just not using activity results for screens you own though - they're great for inter-app communication (like launching the system photo picker), but not so helpful when data you need is now tied to an activity result
a
Yes... We use it on all app, for our navigation... But some edge cases are harder to handle