I would like it to be disabled when I use in certain condition, such as during traveling with GPS.
You can use a script via the terminal to simulate a long action and prevent the screen from timing out. Create the script below and run via Terminal Emulator on your phone. It simulates pressing the letter r and Enter, then wait for a second before repeating the process for the number of times you choose with i
.
#!/system/bin/sh
i=86400 #Put a big number here
while [ $i -gt 0 ]
do
i=$(( $i - 1 ))
input keyevent 46 #Write the letter r
input keyevent 66 #Simulate Enter key on the keyboard
sleep 1
#Do nothing for 1 second
done
Save the file, give it a name for example test.sh
. Open the terminal and navigate to the folder where the file is saved (if you don't know the path, use your file manager to get the path) with the command:
cd /path/to/your/folder
Then execute the command:
sh test.sh
The script will start running. When you no longer need it to run, just close the terminal.
Caffeinate add a tile in the quick settings. In Caffeinate Settings, click on Caiffeine Tile, enable "Skip To Infinite Mode". Open the quick settings, click on the app tile. The screen should stays on until you press the tile again or click cancel on its notification.
Q & A