Android lock screen life cycle issues

Source: Internet
Author: User
Tags locale

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"


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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.