I'm working on an app which only requires approximate location, so
naturally, I've requested this in my manifest:

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

This works fine on an actual device (G1), but on the emulator, I can't
find a way to get any location data. Not only is there no
NETWORK_PROVIDER, but requesting an ACCURACY_COARSE provider returns
null:

final LocationManager lm =
  (LocationManager) getSystemService(Context.LOCATION_SERVICE);
final Criteria criterion = new Criteria();
criterion.setAccuracy(Criteria.ACCURACY_COARSE);
String provider = lm.getBestProvider(criterion, false);

And when working from this manifest, even requesting *any* provider
returns an empty list:

final LocationManager lm =
  (LocationManager) getSystemService(Context.LOCATION_SERVICE);
final List<String> providers = lm.getProviders(false);

Which tells me that the emulator has no coarse location provider at
all.

My code works fine if I use android.permission.ACCESS_FINE_LOCATION
and send a mock location through DDM, no problems there. And of
course, a workaround is to keep it like that during development, and
only switch over to ACCESS_COARSE_LOCATION for release. But I'd really
like to avoid that step - it's a PITA, I have little doubt that I'll
forget to do it someday. :^/

Thanks for any ideas,

String
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to