today in the video playback encountered a problem: when the user pressed the power button lock screen (the screen is black) video playback stopped. However, when the unlock key is pressed (the screen is on, but not unlocked), the video starts to play automatically.
My activity is configured in Manifest.xml as follows
Android:configchanges= "Locale|orientation|keyboardhidden"
android:screenorientation= "Landscape"
Workaround:
You need to add a screensize in the android:configchanges= "Locale|orientation|keyboardhidden"
Android:configchanges= "locale|orientation|keyboardhidden| screensize "
Google Official Note:
The physical screen size has changed. This represents a change in size regardless of orientation and so would only be change when the actual physical screens size has C Hanged such as switching to an external display. A change-to-this configuration corresponds-a change in the Smallestwidth configuration. However, if your application targets API level/lower, then your activity all handles this configuration change it Self (thisconfiguration change does not restart your activity, even if running on an Android 3.2 or higher device ).
Basically, when your program target API is less than or equal to 12 o'clock, switching the display will restart your activity.
Android lock screen life cycle issues