The following code works in the emulator if I manually send GPS coordinates, but the problem is that the after 2 location updates the program no longer responds to subsequent gps coordinate updates.
Ie. Run program in debug mode -> use ddms to send gps coord manually (works) -> use ddms to send gps coord manually (works) -> subsequent attempts to send gps coord manually does not work
See code below:
Using java Syntax Highlighting
- package com.lbs;
- import android.app.Activity;
- import android.content.Context;
- import android.location.Location;
- import android.location.LocationListener;
- import android.location.LocationManager;
- import android.location.LocationProvider;
- import android.os.Bundle;
- import android.util.Log;
- public class LocationTest extends Activity {
- private LocationListener locationListener = new LocationListener()
- {
- @Override
- public void onLocationChanged(Location location) {
- Log.e("GPSLogger", location.getLatitude() + " " + location.getLongitude());
- }
- @Override
- public void onProviderDisabled(String provider) {
- // TODO Auto-generated method stub
- }
- @Override
- public void onProviderEnabled(String provider) {
- // TODO Auto-generated method stub
- }
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- // TODO Auto-generated method stub
- }
- };
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
- lm.setTestProviderStatus(LocationManager.GPS_PROVIDER, LocationProvider.AVAILABLE, null, System.currentTimeMillis());
- lm.setTestProviderEnabled(LocationManager.GPS_PROVIDER, true);
- lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
- }
- }
Parsed in 0.036 seconds, using GeSHi 1.0.8.4
Suspending all threads I notice the following:
Object.wait(long, int) line: not available [native method]
MessageQueue(Object).wait() line: 288
MessageQueue.next() line: 148
Looper.loop() line: 110
ActivityThread.main(String[]) line: 3948
....
Any suggestions would be much appreciated. I'm stumped.
Thanks

