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

上一篇 / 下一篇  2010-05-04 18:30:51 / 个人分类:手机

转自 http://www.13com.net/article/article.asp?articleid=1041

在开发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'
    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!"

TAG:

Quality Trackers 引用 删除 liyun100   /   2010-05-06 15:40:43
还有一种方式是: 直接打开DDMS
1.找到模拟器SDK的TOOLS目录
2. 双击ddms.bat打开DDMS图形界面,在右手边中选择'Emulator control' tab,可以进行电话和短信的打拔
Quality Trackers 引用 删除 liyun100   /   2010-05-06 15:40:24
还有一种方式是: 直接打DDS
1.找到模拟器SDK的TOOLS目录
2. 双击ddms.bat打开DDMS图形界面,在右手边中选择'Emulator control' tab,可以进行电话和短信的打拔
 

评分:0

我来说两句

Open Toolbar