2013-07-30 74 views
1

我正在使用adb發送SMS。下面的命令 ./adb shell am start -a android.intent.action.SENDTO -d sms:12345 --es sms_body "the body" --ez exit_on_sent true ,同時鍵入和bash的執行,做它的工作,但我的python腳本好像叫./adb只:使用子進程執行ADB命令

ADB = './adb' 
    def callSMScmd(msg, num): 
     adbArgs = ('shell am start -a ' 
       +'android.intent.action.SENDTO -d sms:'+str(num)+' --es' 
       +'sms_body "'+msg+'" --ez exit_on_sent true') 
     call([ADB, adbArgs]) 

正確的回報將是Starting: Intent { act=android.intent.action.SENDTO dat=sms:12345 (has extras) }不幸的是這個腳本列出了亞行的版本和所有可用選項;沒有警告,沒有錯誤。 預先感謝任何幫助

回答

2

製作shell一個單獨的參數:

call(['adb', 'shell', 'am start -a android.intent.action.SENDTO ...'])