100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > Android模拟电话 向Android模拟器打电话和发短消息

Android模拟电话 向Android模拟器打电话和发短消息

时间:2018-11-30 00:30:17

相关推荐

Android模拟电话 向Android模拟器打电话和发短消息

其实和mobile的差不多。

在开发Android程序的时候,我们往往需要处理来电或者短消息,但是在开发过程中基本都是通过模拟器来进行调试,那么下面我们就介绍一下如何向模拟器打电话和发短信。

首先在Eclipse中点击菜单Windows->Open perspective->DDMS进入DDMS视图:

然后在DDMS视图的Emulator Control视窗中,Incoming number框内填入电话号码(随便填),选择Voice,然后点击Call按钮。

模拟器上即可显示来自Incoming number的电话呼叫。

然后在Emulator Tools中选择SMS,并填写短消息内容,然后点击Send按钮。

相应的模拟器上就会收到来自Incoming number发送的该短消息。

当然,如果觉得这个方法太麻烦,也可以用命令行的方式来完成上述操作,先通过命令行telnet localhost 5554,进入Android Console,然后就可以使用命令进行一些操作,拨打电话和发送短消息是使用gsm和sms命令。gsm和sms两个命令的参数如下:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

gsm

allows you to change GSM-related settings, or to make a new inbound phone call

available sub-commands:

list list current phone calls

call create inbound phone call

busy close waiting outbound call as busy

hold change the state of an oubtound call to 'held'

acceptchange the state of an outbound call to 'active'

canceldisconnect an inbound or outbound phone call

data modify data connection state

voicemodify voice connection state

statusdisplay GSM status

sms

allows you to simulate an inbound SMS

available sub-commands:

send send inbound SMS text message

pdu send inbound SMS PDU

完成上述一个电话呼叫和短信的完整命令是:

1

2

gsm call 13908888888

sms send 13908888888 "this is a test sms!"

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。