Getting started with Android Simulators

Source: Internet
Author: User

To play the GPhone simulator, you must first download the Android SDK from google. After decompression, there is a tool folder under the root directory of the SDK, which contains the simulator and some useful tools.

Double-click emulator.exe and start the simulator directly. Of course, if you want to customize the simulator, you still need to call it from the command line and start it with parameters. The following describes several common startup parameters:

1. simulator appearance customization:
480x320, landscape: emulator-skin HVGA-L
320x480, portrait: emulator-skin HVGA-P (default)
320x240, landscape: emulator-skin QVGA-L
240x320, portrait: emulator-skin QVGA-P

2. Add the SD card to the simulator:
Emulator-sdcard D: \ sdcard. img

Let's talk about how to create the "sdcard. img" file:
Another useful tool named mksdcard.exe is available in the movie toolsexample directory. You can see the name -- make sdcard. Yes, you can use it to create an "SD card ".

Command:
Mksdcard 1024 m d: \ sdcard. img

OK, so that an SD card with a capacity of 1 GB is created.

Use SDCard:

Create: mksdcard <1024 M> <sdcard. img>
(Bytes (default), K, M)

Connect to the simulator: emulator-sdcard <directory/sdcard. img>

Upload files to SDCard: adb push <directory/audioworkflow> </sdcard/audioworkflow>

 

People who have played mobile phone simulators are generally most interested in, of course, what can simulators do? Here is one by one:

The GPhone simulator has a unique number: 15555218135, which is similar to the SIM card number of our mobile phone. To implement dialing, use a mobile phone? Of course not!

Simpler, three steps:
1. Run cmd
2. Connection: telnet localhost 5554
3. Command: gsm call 15555218135

Look! Is a call displayed on the simulator? The same as the physical phone.

Text messages are as simple as text messages. Repeat steps 1 and 2 and modify the third part of the command:
Sms send 15555218135 Hello, this is a Message.

Let's talk about the file transfer method between the PC and the simulator. In this example, another important tool is used, and the "adb.exe" directory is also used ".

Adb:

Adb (Android Debug Bridge) is a common debugging tool provided by Android. With this tool, we can manage the status of devices or mobile phone simulators. You can also perform the following operations:
1. quickly update the code in a device or mobile phone simulator, such as an application or Android system upgrade;
2. Run shell commands on the device;
3. Manage the ports on the device or mobile phone simulator;
4. Copy or paste a file on the device or mobile phone Simulator

Some common operations:

Go to Shell: adb shell

Through the above command, you can enter the shell environment of the device or simulator. In this Linux Shell, You can execute various Linux commands. In addition, if you only want to execute one shell command, you can use the following methods:
Adb shell [command]
For example, adb shell dmesg prints the kernel debugging information.
(The linux shell of Android has been greatly simplified, and many common linux commands are not supported)

Upload File: adb push <PC File> </tmp/...>
Download file: adb pull </tmp/...> <PC File>

Installer: adb install <*. apk>
Uninstall software: adb shell rm/data/app/<*. apk>

Add that the software installed through adb (*. apk) is in the "/data/app/" directory, so you do not have to specify the path during installation. To uninstall the SDK, simply execute "rm.

End adb: adb kill-server

Display the android simulator status:
Adb devices)
Adb get-product (Device Model)
Adb get-serialno (serial number)

Device waiting for running: adb wait-for-device

Port forwarding: adb forward tcp: 5555 tcp: 1234
(Forward the default port TCP 5555 to port 1234)

View bug report: adb bugreport

Adb shell sqlite3 Access Database SQLite3
Adb shell logcat-B radio records wireless communication logs: Generally, there are a lot of wireless communication logs and there is no need to record them during running, but we can still set the record through the command:

Application configuration file:
In "AndroidManifest. xml"
"<Category android: name =" android. intent. category. LAUNCHER "/>"
Determines whether the application is displayed on the Panel.

Bytes -----------------------------------------------------------------------------------

Am command (use am in shell to load android applications ):
Am [start | instrument]

Am start [-a <ACTION>]
[-D <DATA_URI>]
[-T <MIME_TYPE>]
[-C <CATEGORY> [-c <CATEGORY>]...]
[-E <EXTRA_KEY> <EXTRA_VALUE> [-e <EXTRA_KEY> <EXTRA_VALUE>...]
[-N <COMPONENT>] [-D] [<URI>]

Am instrument [-e <ARG_NAME> <ARG_VALUE>]
[-P <PROF_FILE>]
[-W] <COMPONENT>

Start the browser:
Am start-a android. intent. action. VIEW-d http://www.google.cn/

Call number:
Am start-a android. intent. action. CALL-d tel: 10086

Start google map to go directly to Beijing:
Am start-a android. intent. action. VIEW geo: 0, 0? Q = beijing

Bytes -----------------------------------------------------------------------------------

Directory:
# Ls
Ls
Sqlite_stmt_jou
Cache
Sdcard
Etc
Init
Init. goldfish. r
Init. rc
Data
System
Proc
Sys
Sbin
Default. prop
Root
Dev

The sequence of the file stream strings obtained from andorid is arranged in the order of "type + permission + owner + array + size + date + name + link, "d" indicates a folder, "l" indicates a link, and "-" indicates a file.

For example, d rwxrwx --- system cache

The preceding directory is parsed by parsing the strings returned by the ls command.

Bytes -----------------------------------------------------------------------------------

Database:

Contact (including call records) Database:/data/com. android. providers. contacts/databases/contacts. db
Media repository (like recording ringtone settings):/data/com. android. providers. media/internal. db
System settings:/data/com. android. providers. settings/databases/settings. db
SMS Library:/data/com. android. providers. telephony/databases/mmssms. db
Web settings:/data. data/com. android. settings/databases/webview. db
Map search history:/data/com. google. android. apps. maps/databases/search_history.db
Account library? (Contains androidId information):/data/com. google. android. googleapps/databases/accounts. db

Ringtone:/system/media/audio
Time zone settings:/data/property/persist. sys. timezone

Bytes -----------------------------------------------------------------------------------
Current installation mode
Before installation:
1. emulator-wipe-data
2. adb push busybox ./
3. adb shell./busybox tar-cf/tmp/data.tar/data
4. adb pull/tmp/data.tar.
5. mkdir original
6. cd original
7. tar-xf ../data.tar

After installation:
1. adb shell./busybox tar-cf/tmp/data.tar/data
2. adb pull/tmp/data.tar.
3. mkdir after_install
4. cd after_install
5. tar-xf ../data.tar
  
Currently, two related files are added under/data/app and data/data, and the installed program information is added to/data/system/packages. xml. It seems that the menu also shows whether the new installer is obtained from this file and how to display relevant information, such as the name or something.

Differences between android simulators and real machines:

* Calls and calls are not supported. However, you can simulate calls (incoming and outgoing calls) on the console)
* USB connection not supported
* Camera/video capturing is not supported.
* Audio input (capture) is not supported, but output (replay) is supported)
* Extended headphones are not supported
* The connection status cannot be determined.
* The battery level and AC charging status cannot be determined.
* The SD card insertion/pop-up cannot be determined.
* Bluetooth is not supported.

Note the following when using the andoroid simulator:
Users who usually use emulator for testing and development should regularly clean up the C: \ drivers and Settings \ sh \ Local Settings \ Temp \ AndroidEmulator folder, because the Android simulator will generate several temporary files each time it runs. the temporary file with the tmp suffix takes up to 5 GB of disk space for a few months. Users can safely delete these files.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.