Android 简明教程
Android - Emulator
在本章中,我们将探索模拟器中存在于真实安卓设备上的不同功能。
In this chapter we are going to explore different functionalities in the emulator that are present in the real android device.
Creating AVD
如果您希望模拟真实设备,首先根据真实设备创建具有相同设备配置的 AVD,然后从 AVD 管理程序中启动此 AVD。
If you want to emulate a real device, first crate an AVD with the same device configurations as real device, then launch this AVD from AVD manager.
Changing Orientation
通常,当您启动模拟器时,其方向默认为垂直,但您可以通过从键盘按 Ctrl+F11 键来更改其方向。
Usually by default when you launch the emulator, its orientation is vertical, but you can change it orientation by pressing Ctrl+F11 key from keyboard.
首先启动模拟器。显示在下面的图片中 −
First launch the emulator. It is shown in the picture below −
启动后,按 Ctrl+F11 键更改方向。显示如下 −
Once it is launched, press Ctrl+F11 key to change its orientation. It is shown below −
Emulator Commands.
除了方向命令之外,还有其他非常有用的模拟器命令,您在使用模拟器时应记住。它们如下所示 −
Apart from just orientation commands, there are other very useful commands of emulator that you should keep in mind while using emulator. They are listed below −
Sr.No |
Command & description |
1 |
Home Shifts to main screen |
2 |
F2 Toggles context sensitive menu |
3 |
F3 Bring out call log |
4 |
F4 End call |
5 |
F5 Search |
6 |
F6 Toggle trackball mode |
7 |
F7 Power button |
8 |
F8 Toggle data network |
9 |
Ctrl+F5 Ring Volume up |
10 |
Ctrl+F6 Ring Volume down |
Emulator - Sending SMS
你可以模拟发送短信到你的模拟器。有两种方法可以做到这一点。你可以从 Android studio 中的 DDMS(DDMS 可以在 Android Studio 中找到),也可以从 Telnet 中(Windows 中的网络实用工具),进行发送。
You can emulate sending SMS to your emulator. There are two ways to do that. You can do that from DDMS which can be found in Android studio, or from Telnet.(Network utility found in windows).
Sending SMS through Telnet.
Telnet 在 Windows 中默认情况下没有启用。你必须启用它才能使用它。一旦启用,你可以转到命令提示符,并通过输入 telnet 来启动 Telnet。
Telnet is not enabled by default in windows. You have to enable it to use it. Once enabled you can go to command prompt and start telnet by typing telnet.
为了发送短信,记下 AVD 编号,该编号可以在模拟器的标题栏中找到。它可能是 5554 等。记下后,在命令提示符中键入此命令。
In order to send SMS , note down the AVD number which can be found on the title bar of the emulator. It could be like this 5554 e.t.c. Once noted , type this command in command prompt.
telnet localhost 5554
输入命令后按回车键。它在图中显示如下。
Press enter when you type the command. It is shown below in the figure.
你会看到你现在已连接到你的模拟器。现在键入此命令以发送消息。
You will see that you are now connected to your emulator. Now type this command to send message.
sms send 1234 "hello"
输入此命令后,按回车键。现在看 AVD。你会收到一个通知,显示你收到了一条新短信。如下所示:
Once you type this command , hit enter. Now look at the AVD. You will receive a notification displaying that you got a new text message. It is shown below −
Emulator - Making Call
你可以轻松地使用 Telent 客户端向你的模拟器拨打电话。你需要从 Telnet 连接到你的模拟器。它在上面的发送短信主题中进行了讨论。
You can easily make phone calls to your emulator using telent client. You need to connect to your emulator from telnet. It is discussed in the sending sms topic above.
之后,你将在 Telnet 窗口中键入此命令以拨打电话。它的语法如下所示:
After that you will type this command in the telent window to make a call. Its syntax is given below −
gsm call 1234
输入此命令后,按回车键。现在看 AVD。你将收到你放入命令中号码的来电。如下所示:
Once you type this command , hit enter. Now look at the AVD. You will receive a call from the number your put in the command. It is shown below −
Emulator - Transferring files
你可以轻松地将文件传输到模拟器中和反之亦然。为此,你需要在 Android studio 中选择 DDMS 实用工具。然后选择文件资源管理器选项卡。如下所示:
You can easily transfer files into the emulator and vice versa. In order to do that, you need to select the DDMS utility in Android studio. After that select the file explorer tab. It is shown below −
浏览资源管理器并创建新文件夹、查看现有内容等。
Browse through the explorer and make new folder , view existing contents e.t.c.