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

其实和mobile的差不多。

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

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

android-emulator-call-and-sms-01

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

android-emulator-call-and-sms-02

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

android-emulator-call-and-sms-04

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

android-emulator-call-and-sms-03

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

android-emulator-call-and-sms-06

当然,如果觉得这个方法太麻烦,也可以用命令行的方式来完成上述操作,先通过命令行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'
accept change the state of an outbound call to 'active'
cancel disconnect an inbound or outbound phone call
data modify data connection state
voice modify voice connection state
status display 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!"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值