AnoojNair
AnoojNair

Reputation: 501

getLastKnownLocation(LocationManager.GPS_PROVIDER) returns NULL

I am new to Android and I am trying to write one test app which should display the latitude and longitude of the current location. Right Now, I am using Android Emulator to do so. This is the code I am using.

locationManager = (LocationManager)getSystemService(context);
Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);

But the location object returns NULL rather than some mock location. I have added the permission in manifest too.

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

How can I achieve this Android emulator?

Upvotes: 0

Views: 1755

Answers (1)

pna
pna

Reputation: 5761

you have to telnet to your instance emulator and put the following:

telnet localhost 5554
geo fix <lat> <lng>

Upvotes: 3

Related Questions