I’ve written a mapping application which uses GPS. Testing this on my phone (a Galaxy S2 running Gingerbread) I could see no change in behaviour according to the values set in the minTime and minDistance arguments – the GPS, as indicated by the system icon stayed on after a fix no matter what minTime was set.
Aware from the SDK docs, that these were only ‘hints’, I wrote my own battery conservation regime by delegating the GPS control to a service with an IBinder which the activities could bind to and receive location updates by means of a BroadcastReceiver. A ‘settings’ menu option activity set parameters (‘GPS sleep time’ and ‘required accuracy’ which would turn off the GPS in the service for the sleep time once the accuracy criterion was satisfied. For completeness I also passed in minTime and minDistance parameters, which based on my empirical evidence I assumed would be redundant. I did my best to explain the effect of these settings in one of the app’s help pages:

Now my phone has just been upgrade to to ICS, I do find that the minTime does affect the state of the GPS (at least as reflected by the satellite icon on the status bar). In fact it disappears for almost exactly the set time after a fix.
I’m now in a quandary as to what to expect from any particular device/OS version combination and how to adapt my app to cope. To try and resolve it I’ll ask two specific questions:
Has any developer observed such a change in behaviour in their device when changing from Gingerbread to ICS?
Is such a change documented anywhere?
All factually based answers will be appreciated.
UPDATE 3rd April – smallest code sample I can produce to demonstrate behaviour of device appended below
public class GPSParamTestActivity extends Activity implements LocationListener,
GpsStatus.Listener {
private LocationManager mLocMgr;
private long mUpdatePeriod = 10000; // 10 seconds
private TextView mLocTV, mStatTV, mGPSStatTV; // 3 TextViews for o/p
private boolean mStatColourToggle, mLocnColourToggle, mGPSStatColourToggle;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Layout at http://dl.dropbox.com/u/67134160/main.xml if needed
}
@Override
protected void onResume() {
super.onResume();
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
mLocTV = (TextView) findViewById(R.id.locnTV);
mStatTV = (TextView) findViewById(R.id.statusTV);
mGPSStatTV = (TextView) findViewById(R.id.gpsStatusTV);
mLocMgr = (LocationManager) getSystemService(LOCATION_SERVICE);
}
@Override
protected void onPause() {
mLocMgr.removeGpsStatusListener(this);
mLocMgr.removeUpdates(this); // Don't leave GPS on
super.onPause();
}
@Override
public void onGpsStatusChanged(int event) {// GpsStatus.Listener fires this one
mGPSStatTV.setTextColor(mGPSStatColourToggle ? Color.RED : Color.BLUE);
mGPSStatColourToggle = !mGPSStatColourToggle;
String str = "";
switch (event) {
case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
str = "GPS_EVENT_SATELLITE_STATUS";
break;
case GpsStatus.GPS_EVENT_FIRST_FIX:
str = "GPS_EVENT_FIRST_FIX";
break;
case GpsStatus.GPS_EVENT_STARTED:
str = "GPS_EVENT_STARTED";
break;
case GpsStatus.GPS_EVENT_STOPPED:
str = "GPS_EVENT_STOPPED";
break;
}
mGPSStatTV.setText(str);
}
@Override
public void onLocationChanged(Location loc) {
mLocTV.setTextColor(mLocnColourToggle ? Color.RED : Color.BLUE);
mLocnColourToggle = !mLocnColourToggle;
String str = null;
NumberFormat formatter = new DecimalFormat("##0.000000");
String fLat = formatter.format(loc.getLatitude());
String fLon = formatter.format(loc.getLongitude());
str = "Lat/Lon " + fLat + "/" + fLon;
mLocTV.setText(str);
}
@Override public void onProviderDisabled(String provider) {}
@Override public void onProviderEnabled(String provider) {}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
// This is never triggered on a Galaxy S2, G'bread or ICS
mStatTV.setTextColor(mStatColourToggle ? Color.RED : Color.BLUE);
mStatColourToggle = !mStatColourToggle;
String str = "Status chg " + provider;
switch (status) {
case android.location.LocationProvider.OUT_OF_SERVICE:
str += " OUT OF SERVICE";
break;
case android.location.LocationProvider.AVAILABLE:
str += " AVAILABLE";
break;
case android.location.LocationProvider.TEMPORARILY_UNAVAILABLE:
str += " TEMPORARILY UNAVAILABLE";
break;
default:
str += " UNKNOWN STATUS";
}
mStatTV.setText(str);
}
public void myClickHandler(View target) {
mLocMgr.removeGpsStatusListener(this); // stop all listeners
mLocMgr.removeUpdates(this); // by default
// 3 buttons for app control, set the listeners to here in the XML
switch (target.getId()) {
case R.id.stopGPSButton:
break; // already done by default
case R.id.tenSecStartButton:
mLocMgr.addGpsStatusListener(this);
mLocMgr.requestLocationUpdates(LocationManager.GPS_PROVIDER,
mUpdatePeriod, 0, (LocationListener) this);
break;
case R.id.zeroSecStartButton:
mLocMgr.addGpsStatusListener(this);
mLocMgr.requestLocationUpdates(LocationManager.GPS_PROVIDER,
0, 0, (LocationListener) this);
break;
}
}
}
.
While it’s not a real answer this post may be interesting: