Android onDestroy () activity causes screen lock

Function

onDestroy in my activity class is called when the screen falls asleep or the screen is locked. I know this should not happen, as the control flow must be enabled onPause () -> onStop (). On the lock screen, the control flow is as follows: onPause () → onStop () → onDestroy () . I gave android:configChanges="orientation|keyboardHidden" in my android manifest, as suggested by answers to similar questions, but that didn't work. The isFinishing () function returns false when checking with onStop ().

Can anyone help me solve this problem.

+6
source share
1 answer

I had the same problem:

Action Lifecycle X Power Button X Lock Screen

The solution was to add configChanges like you, but you did not specify the screenSize type:

 android:configChanges="orientation|keyboardHidden|screenSize" 
+8
source

Source: https://habr.com/ru/post/945928/


All Articles