/** Listener for the On/Off switch */
 @Override
 public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
   if (key.equals(ONOFF_KEY)) {
     running = !running;
     Editor editor = sharedPreferences.edit();
     editor.putBoolean(IS_ON, running);
     editor.commit();
     if (running) {
       if (runNormal)
         SensorPreferenceActivity.start(SensorPreferenceActivity.this.getApplicationContext());
       else
         SensorPreferenceActivity.startLite(SensorPreferenceActivity.this.getApplicationContext());
     } else {
       if (runNormal)
         SensorPreferenceActivity.stop(SensorPreferenceActivity.this.getApplicationContext());
       else
         SensorPreferenceActivity.stopLite(SensorPreferenceActivity.this.getApplicationContext());
     }
   }
   if (key.equals(ANALYTIC_KEY)) {
     runNormal = !runNormal;
     Editor editor = sharedPreferences.edit();
     editor.putBoolean(ANALYTIC_ON, runNormal);
     editor.commit();
     if (running) {
       if (runNormal) {
         SensorPreferenceActivity.stopLite(SensorPreferenceActivity.this.getApplicationContext());
         SensorPreferenceActivity.start(SensorPreferenceActivity.this.getApplicationContext());
       } else {
         SensorPreferenceActivity.stop(SensorPreferenceActivity.this.getApplicationContext());
         SensorPreferenceActivity.startLite(SensorPreferenceActivity.this.getApplicationContext());
       }
     }
   }
 }