1

i have some nexus 7's (2013) that are not rooted and have api 6.0.1 with may security patches.

i have stay awake on in developer options. i have everything off under the display settings except for sleep (which can not be turned off and is set to 30 minutes). despite this, the tablet dims after about 30 minutes.

i tried acquiring and releasing wakelock in on resume and on pause with no joy.

adb shell settings put global stay_on_while_plugged_in 0 - does not work either (neither does a value of 7 - the original value was 3)

Ray Tayek
  • 9,841
  • 8
  • 50
  • 90

2 Answers2

0

Here is the google documentation: https://developer.android.com/training/scheduling/wakelock.html

public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }
}
Paweł Marecki
  • 630
  • 1
  • 9
  • 21
nullvoid
  • 121
  • 8
  • seems to be working (with an: adb shell settings put global stay_on_while_plugged_in 0). i will let it run overnight. – Ray Tayek Jul 12 '16 at 08:24
  • nexus 7 tablet is still bright the next day. also 2 fires are still bright (without any change in global settings). – Ray Tayek Jul 13 '16 at 00:48
0

Just getting the wake_lock permission in the manifest file works for me.

thailey01
  • 165
  • 1
  • 14