3

Possible Duplicate:
How to emulate GPS location in the Android Emulator?

I'm struggling with activating the GPS functionality in the Android Emulator (Eclipse)

I wrote a test program for getting the current location. It's working on my Android Phone.. so I'm sure the app is working.

If I'm testing the program in the Android Emulator from Eclipse... nothing is happening! What am I missing?

I already added GPS support in the AVD I know the Emulator control... but nothing is happening in the app.

Do I need to install some extra futures in the SDK?

I hope someone can point me in the right direction!

Community
  • 1
  • 1
user1404924
  • 95
  • 1
  • 2
  • 11

3 Answers3

5

With the emulator running, do a

telnet localhost 5554

to connect to the emulator. Then you can do several commands, for example:

geo fix (longitude) (latitude)

That command instructs the emulator to behave as if the phone was at those location (basically fake the GPS coordinates).

You can use google maps feature called "drop latlong marker" to get GPS coordinates for a particular place.

Alexandru Cristescu
  • 3,898
  • 3
  • 19
  • 22
  • you mean in this format?! geo fix 42.438878 -71.119277 geo fix 42.439227 -71.119689 geo fix 42.438917 -71.116146 – user1404924 May 19 '12 at 10:31
  • I gave the coordinates...eg. geo fix 122.084095 37.422006 geo fix 42.438878 -71.119277 geo fix 42.439227 -71.119689 geo fix 42.438917 -71.116146 after that I start the app...after a minut or so...de emulator is crashing. did I gave the geo fix in the correct format?! – user1404924 May 19 '12 at 10:39
  • I found this... http://code.google.com/p/android/issues/detail?id=13015#makechanges It looks like the crash is a bug in the emulator...I'm running SDK r19. with emulator 2.3. I wrote this is a problem in the emulator...only workarround isusing another version of the emulator...am I right?! Does anybody have an other soluiton for the problem? – user1404924 May 19 '12 at 11:01
  • You can use an actual phone if you have it (though you need to enable "allow fake locations" or something like that in the phone's settings). Or simply use a different emulator, it takes a couple of minutes at most to set up. – Alexandru Cristescu May 19 '12 at 13:42
2

You just need to send latitude and longitude via Emulator Control under DDMS, no need to other things. pretty simple:)

Mahesh
  • 2,862
  • 2
  • 31
  • 41
0

the geo-fix solution works , but the eclipse ui solution should also work. you are not supposed to install anything special.

try to create a new emulator (which has gps support enabled in its features) and run it , select it in the emulators list under "devices" , and then go to the emulator control . set there the location and press "Send" .

in any case , if that doesn't work , you can even install third party apps on the emulator that do the same thing :

https://play.google.com/store/search?q=location+spoofer&c=apps

android developer
  • 114,585
  • 152
  • 739
  • 1,270
  • thanks....I created a new emulator...higher version lower version...all the same result (crash emulator). How can I download the apk-file... It only goes by google-play... – user1404924 May 19 '12 at 12:52
  • well if you root your phone you can get the file yourself . anyway, i still have no clue why you are having problems . have you also tried to re-install eclipse and the adt&sdk? i even have the preview version 20 : http://tools.android.com/download/adt-20-preview , not that any of the older versions had any gps problems... maybe try checking the settings of the emulator (inside the emulator window itself, during runtime) ? – android developer May 19 '12 at 13:25
  • I can re-install Eclipse... will try that. I created a new simple project with http://hejp.co.uk/android/android-gps-example/ also here I have exactly the same problems. I run the app...no problems... if I send geo fix...the emulator is crashing.... today I lost a day lost with this issue :( – user1404924 May 19 '12 at 14:07
  • well i can't see any reason for this. if you really wish for something that works , you can even go as far as running it on ubuntu . if so,you can try it out by running wubi (so that you can discard of it easily when no longer needed) . the weird thing is that i think that both eclipse and android development work very well on linux. – android developer May 19 '12 at 14:11
  • well ubuntu is not an option...tha't completly new for me... Maybe another emulator... I already looked for it.. but I can't see how I can install my eclipse package then. Well...my phone is also no option because I need to send SMS messages to test the app....well I'm standing with my back to a wall...I guess :( If anyone is having a working emulator and SDK let me know!! – user1404924 May 19 '12 at 15:58
  • aren't there fake sms senders apps ?maybe this one: https://play.google.com/store/apps/details?id=act.main . would they work well for you for the time being, just till you figure out why the emulator doesn't work with gps faking? i think it's also possible to send sms to the device via usb , like this: http://groups.google.com/group/android-developers/browse_thread/thread/d2aa672877572038 . also , if you wish for an apk for the emulator for faking the gps , PM me and i will send it to you. – android developer May 19 '12 at 16:04
  • to android developer => I believe you saved my day!...for know it's a working solution! Stuppid that I didn't saw this way out! :D – user1404924 May 19 '12 at 16:23
  • what do you mean? what was the solution? does the emulator work now? – android developer May 19 '12 at 17:00
  • no the emulator isn't working. I changed to my real phone for now :( – user1404924 May 23 '12 at 05:25
  • did you try an emulator that has API10 instead of the latest ? maybe the newer versions have problems... anyway , if this answer helped you , please tick it. – android developer May 23 '12 at 05:58
  • I'm working at API10. I also tried older versions and newer versions :( – user1404924 May 23 '12 at 08:52
  • maybe try a different OS or different computer? it's just that i never had such problems . – android developer May 23 '12 at 09:24