I am not sure I follow the question here, in terms of Mock vs
"actual" (are you using the emulator, or an actual device, and if you
are using the emulator remember you have to send a location to it
before it will have a location set, if you just start it up, it won't
know where it is - use the DDMS tool or such).


Location location = this.locationManager.getLastKnownLocation
(locationProvider);

Where locationManager is a LocationManager:
locationManager = (LocationManager) this.getSystemService
(Context.LOCATION_SERVICE);

And locationProvider is a LocationProvider that represents "gps":
locationProvider = this.locationManager.getProvider("gps");

A Location object has lat/long and more (depending on the provider):
http://code.google.com/android/reference/android/location/Location.html.

You can also register to get location updates using a
LocationListener, or a BroadcastReceiver (and MyLocationOverlay,
though it's a bit more coarse grained).





On Nov 19, 8:55 am, "salman.geek" <[EMAIL PROTECTED]> wrote:
> Hi to all.
> Im facing some problems in getting the actual coordinates through the
> GPS.Using the LocationBasedService API i have got the coordinates
> provided by the Mock location as mentioned in the Api but please Help
> me in making DIrect communication with the GPS.
>
> How can i get the Coordinates from the GPS?
>
> The samples which i have got from internet was all from the old sdks.
> Im using the latest Android  SDK version 1.0.
> Please Help me as soon as possible i will be really grateful to all of
> u.
>
> Regards,
> Salman Khursheed
--~--~---------~--~----~------------~-------~--~----~
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