Search code examples
androidandroid-intentbroadcastreceiverintentfilter

Is it possible to send a signal from an intent and recover it in another intent


I have 2 activities.. one is launched via deep links. MainActivity doesn't start DeeplinkActivity. How do I know from MainActivity when DeeplinkActivity finishes.

I have tried setting an intent filter programmatically. then added it to MainActivity then in DeeplinkActivity sendBroadcast.

I was unsuccessful since the broadcast recover method in MainActivity wasn't responding to broadcast sent from Deeplink via sendBroadcast(getIntent())


Solution

  • You can use interface, inside onDestroy() of DeepLink activity call the interface method and implement the method in MainActivity. Check this answer. https://stackoverflow.com/a/19027202/7248394