title: Android Bluetooth - detect a disconnection from a device
body: <p>I am trying to catch a bluetooth device disconnection intent filter.
  I added a log to the onReceive but it never reaches it and is not displayed in the logcat.
  I suspect that the problem is with my manifest.xml configuration:</p>
  
  <p>manifest:</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.company"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="10"
          android:targetSdkVersion="16" /&gt;
  
      &lt;uses-permission android:name="android.permission.BLUETOOTH" /&gt;
      &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /&gt;
  
      &lt;application
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;receiver android:name="com.company.MyReceiver" android:enabled="true" android:exported="true"&gt;
              &lt;intent-filter&gt;
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
                  &lt;action android:name="android.bluetooth.device.action.ACL_DISCONNECT_REQUESTED" /&gt;
                  &lt;action android:name="android.bluetooth.adapter.action.CONNECTION_STATE_CHANGED" /&gt;
                  &lt;action android:name="android.bluetooth.adapter.action.DISCOVERY_STARTED" /&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
  
          &lt;activity
              android:name=".BTActivity"
              android:label="BTActivity" &gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>MyReceiver extends BroadcastReceiver:</p>
  
  <pre><code>@Override
      public void onReceive(Context context, Intent intent) {
          Log.i("got-in", "got-in-");
          // String action = intent.getAction();
          BluetoothDevice device = intent
                  .getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
  
          Log.i("disconnect", device.getName());
          Intent i = new Intent(context, BTActivity.class);
          Bundle b = new Bundle();
          b.putString("deviceName", device.getName());
          intent.putExtras(b); // Put your id to your next Intent
          context.startActivity(i);
          // finish();
  
      }
  </code></pre>