The emulator doesn't have a gps device. If you want to test it, you
have to use the location test tools that come with the sdk. In
Eclipse, there's a tool in DDMS that allows you to enter gps
coordinates for the emulator. Here (http://kurl.nl?44FE) is a tool
that converts locations to gps coordinates.

On Nov 8, 9:03 pm, "dave.marsden" <[EMAIL PROTECTED]
services.co.uk> wrote:
> I'm trying to get some basic location code working, I've started from
> the standard hello world type app, and have changed it to print the
> current location. with the following code.
>
> package com.android.tracker;
>
> import android.app.Activity;
> import android.os.Bundle;
>
> import android.app.Activity;
> import android.content.Context;
> import android.os.Bundle;
> import android.location.Criteria;
> import android.location.Location;
> import android.location.LocationManager;
> import android.widget.TextView;
>
> public class AndroidTracker extends Activity {
>    /** Called when the activity is first created. */
>   [EMAIL PROTECTED]
>    public void onCreate(Bundle savedInstanceState) {
>        super.onCreate(savedInstanceState);
>        TextView tv = new TextView(this);
>        LocationManager lm =
> (LocationManager)getSystemService(Context.LOCATION_SERVICE);
>
>        Location loc = lm.getLastKnownLocation("GPS");
>        String pos = loc.toString();
>        tv.setText(pos);
>        setContentView(tv);
>    }
>
> }
>
> However the getLastKnownLocation is returning null in the emulator.
> Can anybody tell me what I'm doing wrong?
>
> Thanks
>
> Dave.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
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