title: Android 6.0.1 API 23 - Beacon Library not working
body: <p>I am having problem with the AltBeacon Android Beacon Library, I have set all the permisions (<code>BLUETOOTH, BLUETOOTH_ADMIN, ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION</code>), but my app for some reasons can't detect any beacons (tried with few different). I am using Samsung Galaxy Tab with android 6.0.1.
  While I run my app I get this messages:
  <code></p>
  
  <pre><code>I/BeaconActivity: I have just switched from seeing/not seeing beacons: 0
  D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 48 - 0, 0) vi=Rect(0, 48 - 0,     0) or=1
  D/libGLESv1: STS_GLApi : DTS is not allowed for Package : com.example.tgesior.beacons
  D/BluetoothAdapter: STATE_ON
  D/BluetoothAdapter: STATE_ON
  D/BluetoothLeScanner: Start Scan
  D/BluetoothAdapter: STATE_ON
  D/BluetoothAdapter: STATE_ON
  D/BluetoothAdapter: STATE_ON
  D/BluetoothAdapter: STATE_ON
  I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@8c2357 time:32794199
  D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=7
  D/ScanRecord: parseFromBytes
  D/ScanRecord: first manudata for manu ID
  D/ScanRecord: parseFromBytes
  D/ScanRecord: first manudata for manu ID
  D/ScanRecord: parseFromBytes
  D/ScanRecord: first manudata for manu ID
  D/ScanRecord: parseFromBytes
  D/ScanRecord: first manudata for manu ID
  D/ScanRecord: parseFromBytes
  D/ScanRecord: first manudata for manu ID
  D/ScanRecord: parseFromBytes
  D/ScanRecord: first manudata for manu ID
  D/ScanRecord: parseFromBytes
  D/ScanRecord: first manudata for manu ID
  D/ScanRecord: parseFromBytes
  D/ScanRecord: first manudata for manu ID
  D/ScanRecord: parseFromBytes
  D/ScanRecord: first manudata for manu ID
  D/ScanRecord: parseFromBytes
  D/ScanRecord: first manudata for manu ID
  D/ScanRecord: parseFromBytes
  D/ScanRecord: first manudata for manu ID
  D/ScanRecord: parseFromBytes
  D/ScanRecord: first manudata for manu ID
  D/ScanRecord: parseFromBytes
  D/ScanRecord: first manudata for manu ID
  D/ScanRecord: parseFromBytes
  D/ScanRecord: first manudata for manu ID
  D/ScanRecord: parseFromBytes
  D/ScanRecord: first manudata for manu ID
  D/BluetoothAdapter: STATE_ON
  D/BluetoothAdapter: STATE_ON
  D/BluetoothLeScanner: Stop Scan
  D/BluetoothLeScanner: Start Scan
  D/BluetoothAdapter: STATE_ON
  D/BluetoothAdapter: STATE_ON
  D/BluetoothAdapter: STATE_ON
  D/BluetoothAdapter: STATE_ON
  D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=7
  </code></pre>
  
  <p></code>
  and so on, here is my code:
  <code></p>
  
  <pre><code>private BeaconManager beaconManager =null;
  
  private static final String ALTBEACON_LAYOUT = "m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25";
  
  private static final int PERMISSION_REQUEST_COARSE_LOCATION = 1;
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_beacon);
  
      if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.M) {
          if (this.checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
              final AlertDialog.Builder builder = new AlertDialog.Builder(this);
              builder.setTitle("This app needs location access");
              builder.setMessage("Please grant location access so this app can detect beacons.");
              builder.setPositiveButton(android.R.string.ok, null);
              builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
                  @Override
                  public void onDismiss(DialogInterface dialog) {
                      requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, PERMISSION_REQUEST_COARSE_LOCATION);
                  }
              });
              builder.show();
          }
      }
  
      beaconManager = BeaconManager.getInstanceForApplication(this);
      beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout(ALTBEACON_LAYOUT));
      beaconManager.setForegroundScanPeriod(30000l);
      beaconManager.setForegroundBetweenScanPeriod(21000l);
  
      beaconManager.bind(this);
  
  }
  
  public void onRequestPermissionsResult(int requestCode,
                                         String permissions[],
                                         int[] grantResults) {
      switch (requestCode) {
          case PERMISSION_REQUEST_COARSE_LOCATION: {
              if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                  Log.d(TAG, "coarse location permission granted");
              } else {
                  final AlertDialog.Builder builder = new AlertDialog.Builder(this);
                  builder.setTitle("Functionality limited");
                  builder.setMessage("Since location access has not been granted, this app will not be able to discover beacons when in the background.");
                  builder.setPositiveButton(android.R.string.ok, null);
                  builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
                      @Override
                      public void onDismiss(DialogInterface dialog) {
                      }
                  });
                  builder.show();
              }
              return;
          }
      }
  }
  
  @Override
  public void onBeaconServiceConnect() {
      beaconManager.addMonitorNotifier(new MonitorNotifier() {
          @Override
          public void didEnterRegion(Region region) {
              Log.i(TAG, "I just saw an beacon for the first time!");
          }
  
          @Override
          public void didExitRegion(Region region) {
              Log.i(TAG, "I no longer see an beacon");
          }
  
          @Override
          public void didDetermineStateForRegion(int state, Region region) {
              Log.i(TAG, "I have just switched from seeing/not seeing beacons: "+state);
          }
      });
  
      try {
          beaconManager.startMonitoringBeaconsInRegion(new Region("myMonitoringUniqueId", null, null, null));
      } catch (RemoteException e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p></code></p>