0

I'd like to test my LocationListener() fully on the emulator, to see if it works correctly in all circumstances. Is there a way to test onProviderDisabled() and onProviderEnabled() using the emulator?

    location_listener = new LocationListener(){

        public void onLocationChanged(Location location) {
            // Update application based on new location 
            updateLocation(location); 
        }

        public void onProviderDisabled(String provider) {
            // Update application if provider disabled
            setContentView(R.layout.lostgps);
        }

        public void onProviderEnabled(String provider) {
            // Update application if provider enabled 
            setContentView(R.layout.game); 
        }

        public void onStatusChanged(String provider, int status,
                Bundle extras) {
            // Update application if provider hardware status changed 
        }

    };
Eilidh
  • 1,354
  • 5
  • 21
  • 43

1 Answers1

1

Yes, you can use LocationManager.setTestProviderEnabled() and LocationManager.setTestProviderStatus() to test the listener.

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134