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. */
@Override
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 [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
-~----------~----~----~----~------~----~------~--~---