Force application to restart from first Activity (when a permission is denied)

后端 未结 5 1818
庸人自扰
庸人自扰 2021-02-02 09:46

It is known that when we deny permissions at runtime in Android 6.0 and resume the app from the recent menu, the app process

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-02 10:19

    I don't know if anyone is still looking for an answer on this, but I'd solve by reversing the logic, instead of waiting for a flag indicating the restart/recreate due to the denial of permission, pass a flag indicating that the Activity was started by another Activity and not recreated by the system. So if FLAG doesn't come in extras then the activities stack must be destroyed and first activity lauched.

    Hope it helps someone.

提交回复
热议问题