Exit Youtube/Netflix app and go back to my current app

Hello everyone, I am developing an app that has the feature of opening Youtube, Netflix app when clicking on the icon. I have used Application Manager API to open the app. I am having a problem that is there a way to go back to my app after pressing the Back button or exit on Youtube, Netflix app when opening from my app? The steps are as follows:

  • Click on the icon on my app to open Youtube/Netflix
  • Watch a video on Youtube/Netflix, and when on the home page of those apps press the Back button or exit the app to go back and open my current app.

Looking forward to receiving help. Thank you very much

Currently, no API is provided to return to the app. You can’t go back to your app. Thank you.

To return to your app after opening YouTube or Netflix, use Intent.FLAG_ACTIVITY_REORDER_TO_FRONT when launching the apps, which brings your app back when exiting. You can also track the lifecycle with onPause() and onResume() to detect when your app goes to the background and comes back. Using Intent.FLAG_ACTIVITY_NEW_TASK can also help manage the task stack for smoother transitions. These methods help ensure your app returns after the other apps are closed.