3

I have python script that im running on my android phone But the issue is whenever my phone's screen get off or i minimize the app the script get errupt and it doesnt process or works and i have to restart / run it again. Thanks in advance.

tarun
  • 55
  • 1
  • 8

1 Answers1

0

You need to run the script as a background process.

nohup python scripname.py &

should work.

for more details refer to this link

Thalish Sajeed
  • 1,351
  • 11
  • 25
  • I don't think this is a nice answer because it is not specific to Termux! Using nohup won't do much if the "computer" is halted, as happens with termux when screen is turned off. Acquiring wake-lock through GUI or by using the command `termux-wake-lock` is an option, but it won't work for every phone. – Pedro Queiroga Jun 26 '21 at 16:31