How to enable Stay awake in the developer options using ADB?

I’m trying to find a way to enable the Developer options -> Stay awake option via ADB.
The solution that I found was to find a way to open developers option menu and then enable stay awake option using setevent command in ADB.

Now I’m trying to find the command that will open the developers options.
I found the command that opens display options:

  • Set child layout width programmatically In ANDROID?
  • How to install apk files on my android emulator with Eclipse?
  • Error: Multi dex requires Build Tools version
  • Size of bitmap returned by camera via intent?
  • What is the counterpart of iOS' QLPreviewController or UIDocumentInteractionController on Android?
  • CreateWalletObjectsRequest is missing from com.google.android.gms.wallet API
  • adb shell am start -n com.android.settings/.DisplaySettings
    

    So I think that a similar command that opens developers options exists.

    I will also be glad to hear about another way to enable stay awake option via ADB if there is any.

  • eclipse, new android application project, “next button” is disabled in section that wants the project name
  • How to create a custom-shaped bitmap marker with Android map API v2
  • android.content.res.Resources$NotFoundException for ic_sync_black_24dp.xml
  • Android - New calendar style DatePicker and TimePicker
  • How to draw circle around a pin using Google MAps API v2
  • SMS URL on Android
  • 4 Solutions collect form web for “How to enable Stay awake in the developer options using ADB?”

    adb shell am start -n com.android.settings/.DevelopmentSettings
    

    OK, I found a way:

    adb shell am start -S com.android.settings/.Settings\$DevelopmentSettingsActivity
    

    I used this : https://github.com/android/platform_packages_apps_settings/blob/master/AndroidManifest.xml

    to find the name of the Activity I needed.

    Now I have to figure out how to choose the stay awake option by createing a touch event or something…

    You can enable Stay awake option without having to use UI with the following command:

    adb shell settings put global stay_on_while_plugged_in 3
    

    try this:

    setprop persist.sys.usb.config mtp,adb
    
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.