In my app there is a long loading process, and if the devices puts on the screen lock, my process stops for some reason.
How can i prevent the device from automatic screen lock?
Turn off auto-lock (Android tablet)Open Settings. Tap the applicable menu option(s), such as Security or Security & location > Security, then locate and tap Screen lock. Select None.
How to remove Screen Lock on your Android phone. Tap Settings > Security > Screen Lock. If prompted, enter your current lock screen code > None > Delete.
Another way to keep the screen lock on without having to request the permission in the manifiest is:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Are you doing your long loading process in the UI thread? Something doesn't seem right - if the process is so long that the screen lock timesout and your process ends, perhaps it needs to go in a background service.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With