The Android simulator emulator several ways to set up geographic information

Source: Internet
Author: User

Using the Android emulator, you can set up your own GPS location information, according to the official Android documentation, there are several ways to do this:

1. Through the command line:

Telnet 5554 # 5554 is the console port for emulator

Geo Fix 121.420413 31.215345 # The first value is longitude (longitude), and the second value is latitude (latitude)
# can get latitude and longitude from Google Maps, https://maps.google.com/

2. Through Eclipse:


The path is set to: Window > Show View > Other > Emulator control.
In the emulator Control Panel, enter GPS coordinates under Location Controls as individual Lat/long, with a GP X file for route playback, or a KML the file for multiple place marks. (Be sure, have a device selected in Devices panel-available from Windows > show View > Other > Devices .)
Using DDMS

3. Through DDMS:

With the DDMS tool, you can simulate location data a few different ways:
Manually send individual longitude/latitude coordinates to the device.
Use a GPX file describing a route for playback to the device.
Use a KML file describing individual place marks for sequenced playback to the device.

I prefer to use the command line.
However, I usually use HAXM or KVM to speed up my emulator (running Intel's image inside), and I find that these settings are not effective for my emulator. This question once bothered me for several days, and later when I was interacting with a colleague, I found that this location information relies on the Google API, and some of Intel's image, which is default without Google API, is not effective (even if GEO Fix command return is OK). Fortunately, the Android SDK also provides Google APIs for x86 image, starting with Android 4.4.
For X86 mirroring such as Android 4.3/4.2, you need to manually add the Google API support by following these steps.

The code is as follows Copy Code
1. In Android Virtual Device Manager Create a AVD with target "Android 4.3/4.2" (actually use arm's image first)
2. Emulator-avd NAME_OF_AVD (start arm image)
3. adb pull/system/etc/permissions/com.google.android.maps.xml (Download Google Maps related documents)
4. adb pull/system/framework/com.google.android.maps.jar (Download Google Maps related documents)
5. (optional) Remove the Create AVD in Android Virtual Device Manager (delete the arm AVD just used, optional)
6. In Android Virtual Device Manager Create a AVD with target "Intel Atom x86 System Image (Intel Corporation)-API Le Vel 18 "(Create Intel x86 image)
8. Emulator-partition-size 1024-NO-SNAPSHOT-SAVE-AVD NAME_OF_AVD (start x86 image)
9. ADB remount RW (make file system writable)
ADB push com.google.android.maps.xml/system/etc/permissions (upload Google Maps related files to x86 iamge)
ADB push com.google.android.maps.jar/system/framework (upload Google Maps related files to x86 iamge)
Download mkfs.yaffs2.x86 (Download address: https://android-group-korea.googlecode.com/files/mkfs.yaffs2.x86)
ADB push mkfs.yaffs2.x86/data (upload mkfs.yaffs2.x86 to image)
ADB shell (shell connected to the Emualtor)
Cd/data
chmod 777 Mkfs.yaffs2.x86
/mkfs.yaffs2.x86/system system.img (re-making system.img document)
Exit (quit ADB shell)
ADB pull/data/system.img (Download production system.img, take a long time, wait patiently)
Copy system.img into AVD directory (copy this system.img to your AVD directory, overwriting the original system.img, you can back up the original)
Reboot Emulator (restart emulator to use to the new system.img)



When I first did so, the following error occurred while uploading the Google Maps file to x86 Image:

jay@jay-linux:~/adt-bundle-linux-x86_ 64-20140321/sdk$ adb push com.google.android.maps.xml/system/etc/permissions
failed to copy ' Com.google.android.maps.xml ' to '/system/etc/permissions/com.google.android.maps.xml ': Out of Memory

was later found to be , the original system.img capacity is only enough to store their own things, there are no other things in store. Therefore, when you start x86 AVD, use the "emulator-partition-size 1024 avd-for-x86" command to adjust the/data directory size to 1024MB.

Resources:


Android official documents: http://developer.android.com/guide/topics/location/ strategies.html
Intel image uses Google Maps api:http://38911bytes.blogspot.de/2012/03/ how-to-use-google-maps-api-in-android.html
http://stackoverflow.com/questions/9857325/ Google-maps-sdk-with-new-intel-atom-x86-emulator

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.