The manifest must specify the permission to block tracking.
<uses-permission android:name="android.permission.WAKE_LOCK" />
Then in the activity, use the following to turn on the screen during operation.
getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
Remember that unnecessarily holding the screen from excessive exhaustion of power from the user device.
source share