0ne_Up
0ne_Up

Reputation: 501

GPS not working in emulator

I'm developing an app that uses LocationManager.GPS_PROVIDER to request location updates. Everything is working on my Samsung Galaxy S5, but in the emulator I get the exception "java.lang.IllegalArgumentException: provider doesn't exist: gps" when calling requestLocationUpdates().

GPS is enabled in the emulator (both in "Settings" and "Google Settings") and it is set to "High Accuracy".

I've tried setting the location via Android Studio's Extended emulator controls, and using the command line (telnet, geo fix lat lon alt).

The latest SDK tools are installed (25.2.2 rc1), and the emulator is using these ("About" displays Emulator version 25.2.2-3098464).

Thanks for your help

Upvotes: 1

Views: 3021

Answers (3)

androidtester
androidtester

Reputation: 973

If you list the providers available in the API19 emulator (getAllProviders) you will notice that gps is not available. API22 Emulator has not this mistake.

Upvotes: 0

0ne_Up
0ne_Up

Reputation: 501

My emulator was using API 19 (the same as my real device). I just tried creating a new one using API 22, and in this emulator it does work. Still no clue as to why it doesn't work on the other emulator, all system images/SDK tools are installed and everything seems properly configured.

Upvotes: 0

Agbede S.
Agbede S.

Reputation: 28

I'd advise that you simply use GenyMotion - It's a nice emulator and would easily do what you're trying to do. You would need to specify the coordinates in the free version. I'm not sure of the paid version. The link is here. Cheers

Upvotes: 0

Related Questions