Android activity launch mode and deeplink issue

后端 未结 2 1786
梦如初夏
梦如初夏 2021-02-15 12:40

My app has 2 activities. The root activity of the app is the MainActivity. If credentials are missing or invalid the user will be redirected to the LoginActivity while finishing

相关标签:
2条回答
  • 2021-02-15 13:28
    allowTaskReparenting = true
    

    https://developer.android.com/guide/topics/manifest/activity-element#reparent

    May have solved your issue (with this set, when you return to the forwarding app, you will be returning to the activity natural for that app and not the activity that it launched in the target app) Not too sure why true isn't the default for this...

    0 讨论(0)
  • 2021-02-15 13:39

    Well thanks to the tip by orelzion I managed to solve this issue:

    I did create a new DeepLinkActivity which started the MainActivity (which i changhed the launch mode from "singleTask" to "singleTop") with the following flags:

    Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK
    

    All flags are needed in order to take care of a few issues that came up while trying to fix my problem.

    0 讨论(0)
提交回复
热议问题