读蜡烛有感600字:向 Android 模拟器打电话和发短消息|Android|中国手机开发网

来源:百度文库 编辑:九乡新闻网 时间:2024/04/28 21:05:46

其实和mobile的差不多。

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

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

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

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

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

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

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

  gsm

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

  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

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

  gsm call 13908888888

  sms send 13908888888 "this is a test sms!"