@Override
  public void onDestroy() {
    disconnectExit();
    super.onDestroy();
    serviceThread.quit();

    if (Preferences.logging) Log.d(MetaWatch.TAG, "MetaWatchService.onDestroy()");
    PreferenceManager.getDefaultSharedPreferences(context)
        .unregisterOnSharedPreferenceChangeListener(prefChangeListener);

    Monitors.stop(this);
    removeNotification();
    notifyClients();
    mClients.clear();
  }
        public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {

          if (Preferences.logging) Log.d(MetaWatch.TAG, "onSharedPreferenceChanged " + key);

          MetaWatchService.loadPreferences(context);

          if (key.contains("Weather")) {
            Monitors.restart(context);
          }

          if (key.contains("Idle") || key.contains(".app_enabled")) {
            Idle.reset(context);
          }

          if (key.contains("Widgets") || (key.equals("SilentMode"))) {
            Idle.updateIdle(context, true);
          }
        }
  private void initialize() {
    if (!Preferences.loaded) loadPreferences(this);

    PreferenceManager.getDefaultSharedPreferences(context)
        .registerOnSharedPreferenceChangeListener(prefChangeListener);

    createNotification();

    connectionState = ConnectionState.CONNECTING;
    watchState = WatchStates.OFF;
    watchType = WatchType.DIGITAL;

    if (bluetoothAdapter == null) bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

    powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
    wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MetaWatch");

    Monitors.start(this /*, telephonyManager*/);

    // Initialise theme
    BitmapCache.getBitmap(context, "");

    start();
  }