有没有办法测试Android上GPS供应商的损失? (onProviderDisabled())

时间:2012-05-15 20:05:54

标签: android eclipse gps ddms

我想在模拟器上完全测试我的LocationListener(),看它是否在所有情况下都能正常工作。有没有办法使用模拟器测试onProviderDisabled()和onProviderEnabled()?

    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 
        }

    };

1 个答案:

答案 0 :(得分:1)