2012-05-15 55 views
0

我想在模擬器上完全測試我的LocationListener(),以查看它是否在所有情況下都能正常工作。有沒有辦法使用模擬器測試onProviderDisabled()和onProviderEnabled()?有沒有一種方法來測試Android的GPS提供商的損失? (onProviderDisabled())

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 
     } 

    }; 

回答

相關問題