给模拟器发短信/打电话
文章目錄
- 1. 通過 telnet 與模擬器通信
- 1.1 無法使用telnet
- 2.發(fā)送短信
- 2.1 提示:KO: unknown command, try 'help'
- 2.1.1 auth token 提示:authentication token does not match ~/.emulator_console_auth_token
- 3.其他命令
想做一個自動提取短信的功能,所以需要頻繁的使用到收到短信的功能。
1. 通過 telnet 與模擬器通信
打開終端,輸入: telnet localhost 5554
localhost : 本機(jī)地址
5554: 模擬器端口號
成功后提示:
Android Console: Authentication required
Android Console: type ‘a(chǎn)uth <auth_token>’ to authenticate
Android Console: you can find your <auth_token> in
‘C:\Users\Administrator.emulator_console_auth_token’
OK
1.1 無法使用telnet
在cmd中使用telnet,提示:
‘telnet‘ 不是內(nèi)部或外部命令,也不是可運行的程序或批處理文件。
在windows中打開設(shè)置→應(yīng)用→應(yīng)用和功能→程序和功能(在最下方)→啟動或關(guān)閉Windows功能(在左側(cè))→勾選Telnet客戶端。
2.發(fā)送短信
命令 sms send <phone_number> <message>
例:sms send 10086 hello world
模擬器收到 10086 發(fā)來的內(nèi)容為 hello world 的短信。
2.1 提示:KO: unknown command, try ‘help’
原因:未驗證auth token
解決:根據(jù)剛鏈接telnet后的提示,可以知道驗證token的命令是auth <auth token>,auth token 存放在 C:\Users\<Administrator>\.emulator_console_auth_token,用記事本等工具打開,就可以得到token。
例:auth LblHpxTfTOgRk0vI
2.1.1 auth token 提示:authentication token does not match ~/.emulator_console_auth_token
原因:獲取到的token不正確。猜測可能是由于有多個模擬器存在,token僅對應(yīng)其中某一個模擬器。
解決:刪除全部模擬器,刪除.emulator_console_auth_token文件。重新創(chuàng)建一個模擬器,此時會重新生成.emulator_console_auth_token文件。
3.其他命令
打電話: gsm call 10086
模擬10086給你的模擬器打電話。
掛斷電話:gsm cancel 10086
模擬掛掉10086的來電
模擬發(fā)送gps信號
geo fix 經(jīng)度 緯度
即相當(dāng)于將手機(jī)移動到指定的經(jīng)緯度
總結(jié)
以上是生活随笔為你收集整理的给模拟器发短信/打电话的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android 心跳 简书,如何高效维持
- 下一篇: 阿龙的学习笔记---Linux GDB