Introduction to Android Simulator

Source: Internet
Author: User
Tags mkdir access database


To play Gphone Simulator, of course, you need to first go to Google to download the Android SDK, after extracting the SDK under the root directory has a tools folder, which is the simulator and some very useful tools.

Double-click "Emulator.exe" to start the simulator directly, simply. Of course, if you want to make some customization of the emulator, or to call from the command line, with the parameters started. Here are a few of the parameters that are commonly used for startup:

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 SD card to emulator:
Emulator-sdcard d:/sdcard.img

Let's say how to create a "sdcard.img" file:
"Tools" under the directory there is another very useful tool "Mksdcard.exe", a look at the name of the--make SDcard know. Yes, use it to create an "SD card".

The command is:
Mksdcard 1024M d:/sdcard.img

OK, so a 1G SD card is created.

Use SDcard:

Created: Mksdcard <1024M> <sdcard.img>
(bytes (default), K,m)

Connect to Simulator: Emulator-sdcard < directory/sdcard.img>

Transfer files to sdcard:adb push < directory/audio.mp3> </sdcard/audio.mp3>

The person who has played the cell phone simulator is most interested in what the simulator can do, of course. Here are one by one ways to:

Gphone's simulator has a unique number: 15555218135, this is similar to our physical mobile phone SIM card number. To achieve dial-up, use the phone. Of course not.

More simple, three steps:
1. Run cmd
2. Connection: telnet localhost 5554
3. Command: GSM call 15555218135

Look is not the simulator on the display of incoming calls. Answer/hang up and the same as the physical phone.

Texting is just as simple, repeat the above 1, 22 steps, the third order to change:
SMS Send 15555218135 hello,this is a message.

To say the PC and simulator file transfer method. Another important tool needs to be used here, also in the "Tools" directory, "Adb.exe".

ADB:

The ADB is a common debugging tool provided by Android, which allows us to manage the status of devices or phone simulators. You can also perform the following actions:
1, fast update equipment or mobile phone simulator code, such as applications or Android system upgrades;
2, on the device to run the shell command;
3, management equipment or mobile phone simulator on the reservation port;
4. Copy or paste files on the device or cell phone simulator

Some of the most common operations:

Enter SHELL:ADB Shell

With the above command, you can enter the shell environment of the device or emulator, in which you can execute various Linux commands, and if you only want to execute a shell command, you can use the following methods:
ADB Shell [command]
such as: adb shell DMESG will print out the kernel debugging information.
(Android's Linux shell has done a lot of streamlining, many Linux common instructions are not supported)

Uploading files: adb push <pc files > </tmp/...>
Download files: adb pull </tmp/...> <pc files >

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

Add that the software installed through the ADB (*.apk) is in the "/data/app/" directory, so the installation does not need to set the path, uninstall simply need to perform "RM" on the line.

End ADB:ADB Kill-server

Show Android Emulator Status:
ADB devices (port information)
ADB get-product (Equipment model)
ADB Get-serialno (serial number)

Waiting for a running device: ADB wait-for-device

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

View bug report: ADB bugreport

ADB shell sqlite3 Access database SQLite3
ADB shell Logcat-b Radio record wireless communication log: Generally speaking, the wireless communication log is very many, at run time does not need to record, but we can still through the command, sets the record:

Application configuration file:
In "Androidmanifest.xml"
"<category android:name=" Android.intent.category.LAUNCHER "/>"
Decide whether or not the application is displayed on a panel

-----------------------------------------------------------------------------------

AM directives (use AM in Shell to load Android apps):
AM [Start|instrument]

Am start [-a <action>]
[D ]
[-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 Browser:
Am Start-a android.intent.action.view-d http://www.google.cn/

Dial number:
Am Start-a android.intent.action.call-d tel:10086

Start Google Map and navigate directly to Beijing:
Am Start-a Android.intent.action.VIEW geo:0,0?q=beijing

-----------------------------------------------------------------------------------

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

Here to note, the sequence of strings of the file stream obtained from Andorid is sorted by "type + permission + Owner + array + size + Date + name + link to" order. Where the type "D" means the folder, "L" is the link, '-' indicates the file.

For example D rwxrwx---system cache 2009-01-09 11:46 Cache

The above directory is parsed by parsing the string returned by the LS command.

-----------------------------------------------------------------------------------

Database:

Contact person (including call history) database:/data/data/com.android.providers.contacts/databases/contacts.db
Media Library (looks like recording ringtones settings, etc.):/data/data/com.android.providers.media/internal.db
System setup:/data/data/com.android.providers.settings/databases/settings.db
SMS Library:/DATA/DATA/COM.ANDROID.PROVIDERS.TELEPHONY/DATABASES/MMSSMS.DB
Web settings:/data.data/com.android.settings/databases/webview.db
Map Search History:/data/data/com.google.android.apps.maps/databases/search_history.db
Account Bank? (contains androidid information):/data/data/com.google.android.googleapps/databases/accounts.db

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

-----------------------------------------------------------------------------------
The 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
  
At present, it is the/data/app and Data/data under two more related files, while in/data/system/packages.xml added the installation of program information. It seems that the menu is also getting a new installer from this file, and how to display relevant information such as name or whatever.

the difference between an Android simulator and a real machine:

* Does not support calling and receiving actual calls, but can simulate phone calls through the console (inbound and outbound)
* Does not support USB connection
* Does not support camera/video capture
* Does not support audio input (capture), but supports output (replay)
* Does not support extended headphones
* Unable to determine connection status
* Unable to determine battery level and AC charge status
* Unable to determine the SD card insert/Eject
* Does not support Bluetooth

Andoroid Simulator Use Note:
Usually use the emulator test development of the Netizen note should regularly clean down c:/documents and settings/sh/local Settings/temp/androidemulator folder, Since the Android emulator temporarily generates several temporary files for the. tmp suffix each time it is run, it takes a few months to simply look at the amount of disk space up to 5GB. These files can be safely deleted by users.



Http://www.cnblogs.com/ssqjd/archive/2009/02/08/1386427.html

Related Article

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.