You need to use the LocationManager:
lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
--
Jack Ha
Open Source Development Center
・T・ ・ ・Mobile・ stick together
The views, opinions and statements in this email are those of
the author solely in their individual capacity, and do not
necessarily represent those of T-Mobile USA, Inc.
On Aug 9, 9:22 pm, cellurl <[email protected]> wrote:
> From GPS, I am trying to get latitude longitude, bearing and speed.
> Just a one time snapshot.
>
> My code is
> here:http://code.google.com/p/speedlimit/source/browse/#svn/trunk/Speedlim...
>
> Pblm:
> The "loc" is always 0.
>
> Q: Must I initialize the GPS provider somehow??
> Any complete code snippet most welcomed...
>
> -----excerpt from Speedlimit.java---
>
> Gps gps = new Gps();
> gps.doit();
>
> ------Gps.java--------------------------------
>
> package org.speedlimit;
>
> import android.app.Activity;
> import android.location.Location;
>
> public class Gps extends Activity
> {
> private Location loc;
>
> public void doit() {
>
> if (loc != null) {
> double lat= loc.getLatitude();
> double lon= loc.getLongitude();
> }
> }}
>
> --------------------------------------
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---