@Override
 @TargetApi(18)
 public void onDestroy() {
   if (android.os.Build.VERSION.SDK_INT < 18) {
     Log.w(TAG, "Not supported prior to API 18.");
     return;
   }
   bluetoothCrashResolver.stop();
   Log.i(TAG, "onDestroy called.  stopping scanning");
   handler.removeCallbacksAndMessages(null);
   scanLeDevice(false);
   if (bluetoothAdapter != null) {
     bluetoothAdapter.stopLeScan((BluetoothAdapter.LeScanCallback) getLeScanCallback());
     lastScanEndTime = new Date().getTime();
   }
 }