我知道可以通过在仿真器端口上打开一个TCP套接字并使用“send sms”命令来发送短信到模拟器,但是这样也可以接收短信?
我会详细说明 – 我有一个运行在Tomcat服务器上的java应用程序.我也有一个在同一台机器上运行的Android模拟器.我可以使用“sms send”命令从应用程序发送短信到模拟器.我也可以以某种方式接收短信吗?
解决方法
Just connect the emulator using telnet and there we can emulate SMS. Below are the steps to emulate SMS:
Step 1: Start the emulator (with any desired options). Open a new terminal / command shell and type :
adb devices
Note the number after emulator (emulator-5554). This is the port number.
Step 2: Connect to the console using the telnet command:
telnet localhost 5554
Step 3: You will then need to authenticate the session. Find the auth_token in ~/.emulator_console_auth_token and copy the text in the file. Return to the telnet console and enter:
auth {contents_of_token_file}
Step 4: After you have authenticated the shell you can emulate SMS with the command:
sms send <phonesender> <textmessage>
更多信息请参阅此link
如果您从仿真器发送短信,请参阅此http://mobiforge.com/developing/story/sms-messaging-android