Request permission dialog pauses my activity

后端 未结 3 1011
隐瞒了意图╮
隐瞒了意图╮ 2021-01-22 15:47

I am asking for permission inside onActivityResult of my activity and what is happening is that my activity is being paused while request permission dialog is disp

3条回答
  •  春和景丽
    2021-01-22 16:20

    There is also possibility that, your Activity (say, MainActivity) that invoking the

    requestPermissions()
    

    might have been declared flag

    android:noHistory="true" 
    

    in the Manifest.

    Therefore the MainActivity is paused, and eventually finish()'d during requestPermissions(). From Android documentation requestPermissions

    You cannot request a permission if your activity sets noHistory to true in the manifest

    If that is the case.. you may do a finish() clear specific activity programmatically inside the MainActivity { .. } to remove it from the activities stack, not in the Manifest.

    This was in my case !

提交回复
热议问题