Thanks for the tips, but it didn't work. I even deleted all data from the
"-datadir" and then rebooted my computer, but the behavior is still the
same. I have a very simple code (see below) that I took from a tutorial but
even that doesn't work. I believe that I'm missing something here, but I
have no idea what it might be.
Thanks
public class TestActivity extends Activity
{
public static final String TAG = "TestActivity";
private LocationManager lm;
private LocationListener locationListener;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//---use the LocationManager class to obtain GPS locations---
lm = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);
locationListener = new MyLocationListener();
lm.requestLocationUpdates(
LocationManager.GPS_PROVIDER,
0,
0,
locationListener);
}
class MyLocationListener implements LocationListener
{
@Override
public void onLocationChanged(Location loc) {
Log.d(TAG, "===>>> MinhaLocalizacaoListener
onLocationChanged");
if (loc != null) {
Toast.makeText(getBaseContext(),
"Location changed : Lat: " + loc.getLatitude() +
" Lng: " + loc.getLongitude(),
Toast.LENGTH_SHORT).show();
}
}
@Override
public void onProviderDisabled(String provider) {
Log.d(TAG, "===>>> MyLocationListener onProviderDisabled
PROVIDER:"
+ provider);
return;
}
@Override
public void onProviderEnabled(String provider) {
Log.d(TAG, "===>>> MyLocationListener onProviderEnabled
PROVIDER:"
+ provider);
return;
}
@Override
public void onStatusChanged(String provider, int status,
Bundle extras) {
Log.d(TAG, "===>>> MyLocationListener onStatusChanged STATUS:"
+ status + " PROVIDER:" + provider);
return;
}
}
}
On Thu, Dec 11, 2008 at 10:41 AM, Mark Murphy <[EMAIL PROTECTED]>wrote:
>
> Alemao wrote:
> > I really have no idea why
> > this is happening. Is there any kind of permission that I need to have
> > or maybe something that I need to install before trying to use the
> > android GPS?
>
> I have GPS-aware code working with just two permissions:
>
> <uses-permission android:name="android.permission.INTERNET" />
> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
>
> and I probably don't even need the INTERNET one.
>
> First, I would start with an example that works. Find some code that
> behaves properly, then slowly morph that code into what you need.
>
> If something known to work for some reason does not work, there may be a
> problem with your emulator -- you might consider running it once with
> -wipe-data to rebuild it.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com
> _The Busy Coder's Guide to Android Development_ Version 1.9 Available!
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---