Hi all.
I have a python script that I got working on my android phone. Its working perfectly, exept i have a adb shell script, that needs to be run with the python script. I usually do this by hooking my phone to the laptop, but to make it smarter, I'll be run entirely on my phone.
The execute command in the python script:
def change_IP():
os.system(r'""C:\Tools\adb\changeip.bat""')
class Eonda(object):
def change_IP():
os.system(r'""C:\Tools\adb\changeip.bat""')
return
What it does that it changes ip by disabling the 3G data and enables it again. The following bat script is here:
@echo off
set PATH="C:\Scripts\android-sdk-windows\platform-tools"
@echo on
@echo Changing IP Adress
@echo off
adb shell "su -c 'svc data disable'"
adb shell "su -c 'sleep 5'"
adb shell "su -c 'svc data enable'"
adb shell "su -c 'sleep 5'"
I suppose I just could remove the adb shell and the echo's but, how can i execute the terminal commands? It would be easiest to just having some sort of script file, like the bat, but as we all know, batch is a DOS file and Android cant read that, so I need to another solution for this![Smile :) :)](/styles/smilies/google/smilie.png)
I have a python script that I got working on my android phone. Its working perfectly, exept i have a adb shell script, that needs to be run with the python script. I usually do this by hooking my phone to the laptop, but to make it smarter, I'll be run entirely on my phone.
The execute command in the python script:
def change_IP():
os.system(r'""C:\Tools\adb\changeip.bat""')
class Eonda(object):
def change_IP():
os.system(r'""C:\Tools\adb\changeip.bat""')
return
What it does that it changes ip by disabling the 3G data and enables it again. The following bat script is here:
@echo off
set PATH="C:\Scripts\android-sdk-windows\platform-tools"
@echo on
@echo Changing IP Adress
@echo off
adb shell "su -c 'svc data disable'"
adb shell "su -c 'sleep 5'"
adb shell "su -c 'svc data enable'"
adb shell "su -c 'sleep 5'"
I suppose I just could remove the adb shell and the echo's but, how can i execute the terminal commands? It would be easiest to just having some sort of script file, like the bat, but as we all know, batch is a DOS file and Android cant read that, so I need to another solution for this
![Smile :) :)](/styles/smilies/google/smilie.png)