Android Question [Solved] Detach app from the one invoked it through intent

Discussion in 'Android Questions' started by klarsys, May 25, 2015.

  1. klarsys

    klarsys Active Member Licensed User

    I have an app that can be invoked by clicking on a link. I implemented it using intent filter with VIEW action.

    This is how it works:
    1. I receive a link in (let's say) WhatsApp. Link is of the form: http://xyz/abcd
    2. I tap on the link and Android asks me to open with browser or my app.
    3. I select my app.
    4. My app starts and is active.

    Now, the issue:
    5. I press HOME button.
    6. I click on WhatsApp launcher icon.
    7. I see my app coming up, instead of WhatsApp.

    I do not see such behavior if I select browser in step 3.

    How do I detach my app from WhatsApp (in this example) once my app starts through intent filter?
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. klarsys

    klarsys Active Member Licensed User

    I have two activities, the Main activity receives MAIN (launcher) as well as VIEW (intent) actions and after showing a splash screen, starts the UI activity and does Activity.Finish for itself.

    Isn't above sufficient?
    Should I also do Activity.Finish in Activity_Pause?
    Does the seqence Start UI activity, then Activity.Finish matter?

    If I need to change launch mode of UI activity, are there any Activity Attributes or should I use Manifest Editor or do I manually change it?
  4. klarsys

    klarsys Active Member Licensed User

    It seems this matters.

    I did Activity.Finish and then StartActivity(UI) and it works fine.