问题
I downloaded an Android iso from the website Android x86 4.0 RC2 reconfigure keyboard.
Installed VirtualBox selecting a Linux distro ,256 MB RAM, 8 GB HDD.
I loaded the iso into the CD to finally install it on the virtual HDD, the emulator runs smoothly.
I allowedmock locations on the developer settings.
I can connect to internet trough the navigator using a NAT*** after executing the command on my host machine
VBoxManage modifyvm AndroidVM --natpf1 adb,tcp,*,5555,*,5555
*If I select the bridge adapter I can not setup the ethernet, netcfg eth0 dhcp produces a timeout
I can connect adb from the host machine
adb connect localhost
I checked that the device is connected:
C:\Android\android-sdk\platform-tools>adb devices
List of devices attached
localhost:5555 device
But when I try to set/send geolocation to the emulator...
Via Eclipse-->The Emulator Controls -> Locations controls. It does not allow me to edit lat/long and send it.
If I try to connect using telnet localhost 5555, so I could use the geo command, a black screen appears and if I press any button the cursor moves but nothing appears.
Lastly, I tried to install the application Bluetooth GPS, but when Google Play appears to link an account for some reason network is not detected and I can not continue, even if I am previously registered on the google play website within the browser.
Thanks in advance.
回答1:
First, determine the console port number for the target emulator instance. For example, the console port number for the first emulator instance launched is 5554. Next, connect to the console of the target emulator instance, specifying its console port number, as follows:
$ telnet localhost 5554
From the android console you can execute
geo fix <longitude value> <latitude value>
回答2:
on Android x-86 runs no Telnet server. that is why you see a black screen. you can install SSH Server 3.1.apk to run Telnet server. but geo fix command will not be recognized in Android x-86.
回答3:
If you want to set the geolocation through some kind of pipeline, you may find this vbs script usable:
Set client = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
auth_token_file = "C:\Users\" & CreateObject("WScript.Network").UserName & "\.emulator_console_auth_token"
WScript.Sleep 500
client.SendKeys"telnet localhost 5554"
client.SendKeys("{Enter}")
WScript.Sleep 1600
client.SendKeys"auth "
client.SendKeys fso.OpenTextFile(auth_token_file, 1).readAll
client.SendKeys("{Enter}")
WScript.Sleep 1600
client.SendKeys"geo fix 15.9666 45.8154"
WScript.Sleep 1600
client.SendKeys("{Enter}")
WScript.Sleep 1600
client.SendKeys"exit"
client.SendKeys("{Enter}")
client.SendKeys("{Enter}")
来源:https://stackoverflow.com/questions/15348533/how-do-i-set-send-geolocation-parameters-lat-long-to-an-android-x86-emulator