Launch app only in single instance and kill/prevent other instances if started

29 views Asked by At

Let's take an example:

Scenario: I am trying to book a movie ticket using a mobile application and at the time of payment, the app provides me to select any of the payment apps (already installed in my phone) to complete the payment. I select my mobile app, which is a payment app and it gets opened inside the movie ticket booking application.

Problem Statment: The problem is that if my payment app's instance is already running inside the movie ticket booking application, and I minimize it and go launch my payment app separately, it still opens leaving me with two instances running:

  1. My payment app running inside the movie ticket booking app.
  2. My App running separately.

I want that at a time only one instance should live and if someone launches the app separately it should get redirect to the living/running instance.

Note: I have tried using android:launchMode="singleTask" but still facing the issue.

0

There are 0 answers