@@ -70,6 +70,7 @@ public class MainActivity extends Activity implements
7070 private final static String LOCATION_KEY = "location-key" ;
7171 private final static String LAST_LOCATION_UPDATE_TIME_STRING_KEY = "last-location-update-time-string-key" ;
7272 private final static String LAST_WIFI_SCAN_TIME_STRING_KEY = "last-wifi-scan-time-string-key" ;
73+ private final static String LOGGING_ENABLED_KEY = "logging-enabled-key" ;
7374
7475 // Used to access Fused Location API,
7576 // see https://developer.android.com/google/play-services/location.html
@@ -212,6 +213,9 @@ private void updateValuesFromBundle(Bundle savedInstanceState) {
212213 if (savedInstanceState .keySet ().contains (LAST_WIFI_SCAN_TIME_STRING_KEY )) {
213214 lastWifiScanTime = new Date (savedInstanceState .getLong (LAST_WIFI_SCAN_TIME_STRING_KEY ));
214215 }
216+ if (savedInstanceState .keySet ().contains (LOGGING_ENABLED_KEY )) {
217+ loggingEnabled = savedInstanceState .getBoolean (LOGGING_ENABLED_KEY );
218+ }
215219 updateUI ();
216220 }
217221 }
@@ -366,6 +370,7 @@ public void onConnectionSuspended(int cause) {
366370 log .info ("GoogleApiClient connection suspended, attempting reconnect" );
367371 googleApiClient .connect ();
368372 }
373+
369374 /**
370375 * Stores activity data in the Bundle.
371376 */
@@ -378,6 +383,7 @@ public void onSaveInstanceState(@NonNull Bundle savedInstanceState) {
378383 if (lastWifiScanTime != null ) {
379384 savedInstanceState .putLong (LAST_WIFI_SCAN_TIME_STRING_KEY , lastWifiScanTime .getTime ());
380385 }
386+ savedInstanceState .putBoolean (LOGGING_ENABLED_KEY , loggingEnabled );
381387 super .onSaveInstanceState (savedInstanceState );
382388 }
383389
0 commit comments