code: @Override
      public void stop() {
          super.stop();
          try {
              getContext().unregisterReceiver(mBroadcastReceiver);
          } catch(IllegalArgumentException e) {
              Log.d(TAG, "Unable to unregister receiver when stopping, probably not registered");
          }
      }
docs: Unregister USB device intent broadcast receivers and stop waiting for a
  connection.
  
  This should be called before the object is given up to the garbage
  collector to avoid leaking a receiver in the Android framework.