title: Android Marshmallow 6.0.1 Bluetooth Scan Returning No Results
body: <p>Bluetooth in 6.01 seems to be not working as expected with the following code and permissions as per update + appCompat for Kitkat 4.4.4.  </p>
  
  <p><strong>No results are being returned and I have several discoverable devices in the vicinity.</strong></p>
  
  <p>Anyone have any insight as per why?  I am running on a Nexus 5.</p>
  
  <pre><code> &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /&gt;
      &lt;uses-permission android:name="android.permission.BLUETOOTH" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
  
  package bluetoothscanneractivity;
  
  import android.app.Activity;
  import android.bluetooth.BluetoothAdapter;
  import android.bluetooth.BluetoothDevice;
  import android.content.BroadcastReceiver;
  import android.content.Context;
  import android.content.Intent;
  import android.content.IntentFilter;
  import android.os.Bundle;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.ArrayAdapter;
  import android.widget.Button;
  import android.widget.ListView;
  import android.widget.Toast;
  
  import java.util.ArrayList;
  
  public class BluetoothScannerActivity extends Activity {
      //private final BroadcastReceiver FoundReceiver = null;
      protected ArrayList&lt;BluetoothDevice&gt; foundDevices = new ArrayList&lt;BluetoothDevice&gt;();
      private ListView foundDevicesListView;
      private ArrayAdapter&lt;BluetoothDevice&gt; btArrayAdapter;
  
      /**
       * Called when the activity is first created.
       */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_bluetooth_scanner);
          final BluetoothAdapter myBlueToothAdapter = BluetoothAdapter.getDefaultAdapter();
          final Button scanb = (Button) findViewById(R.id.button);
          final ListView foundDevicesListView = (ListView) findViewById(R.id.listView1);
  
          btArrayAdapter = new ArrayAdapter&lt;BluetoothDevice&gt;(this,
                  android.R.layout.simple_list_item_1, foundDevices);
          foundDevicesListView.setAdapter(btArrayAdapter);
  
          //Turn on Bluetooth
          if (myBlueToothAdapter == null)
              Toast.makeText(BluetoothScannerActivity.this, "Your device doesnot support Bluetooth", Toast.LENGTH_LONG).show();
          else if (!myBlueToothAdapter.isEnabled()) {
              Intent BtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
              startActivityForResult(BtIntent, 0);
              Toast.makeText(BluetoothScannerActivity.this, "Turning on Bluetooth", Toast.LENGTH_LONG).show();
          }
          //scan
          scanb.setOnClickListener(new OnClickListener() {
              public void onClick(View v) {
                  btArrayAdapter.clear();
                  myBlueToothAdapter.startDiscovery();
                  Toast.makeText(BluetoothScannerActivity.this, "Scanning Devices", Toast.LENGTH_LONG).show();
  
              }
          });
  
          registerReceiver(FoundReceiver, new IntentFilter(BluetoothDevice.ACTION_FOUND));
          IntentFilter filter = new IntentFilter(
                  BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
          this.registerReceiver(FoundReceiver, filter);
  
      }
  
      @Override
      protected void onDestroy() {
          // TODO Auto-generated method stub
          super.onDestroy();
          unregisterReceiver(FoundReceiver);
      }
  
      private final BroadcastReceiver FoundReceiver = new BroadcastReceiver() {
          @Override
          public void onReceive(Context context, Intent intent) {
  
              String action = intent.getAction();
  
              // When discovery finds a new device
              if (BluetoothDevice.ACTION_FOUND.equals(action)) {
                  // Get the BluetoothDevice object from the Intent
                  BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
                  if (!foundDevices.contains(device)) {
                      foundDevices.add(device);
                      btArrayAdapter.notifyDataSetChanged();
                  }
              }
  
              // When discovery cycle finished
              if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
                  if (foundDevices == null || foundDevices.isEmpty()) {
                      Toast.makeText(BluetoothScannerActivity.this, "No Devices", Toast.LENGTH_LONG).show();
                  }
              }
  
          }
      };
  
  
  }
  </code></pre>