title: Can't find Bluetooth LE device
body: <p>I am doing project to detect the BLE device surround you. But however the device can't find any BLE device near by. Device supports BLE, but my coding can't detect the BLE device. Please help me if any mistake or anything missing. </p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  BluetoothLeScanner leScanner;
  ArrayList&lt;ScanFilter&gt; scanFilters;
  ScanSettings settings;
  ProgressDialog dialog;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      Button scanStartbtn= (Button) findViewById(R.id.startscanbtn);
      final BluetoothAdapter adapter=BluetoothAdapter.getDefaultAdapter();
  
      settings=new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build();
      scanFilters=new ArrayList&lt;ScanFilter&gt;();
      scanStartbtn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              leScanner=adapter.getBluetoothLeScanner();
              leScanner.startScan(scanFilters,settings,mScanCallback);
              Toast.makeText(MainActivity.this, "Scanning started", Toast.LENGTH_LONG).show();
  
          }
      });
  
  }
  
  
  
  ScanCallback mScanCallback=new ScanCallback() {
      @Override
      public void onScanResult(int callbackType, ScanResult result) {
          super.onScanResult(callbackType, result);
          Toast.makeText(MainActivity.this, "Hey I found BLE device+onScanResult" + result.toString(), Toast.LENGTH_LONG).show();
      }
  
      @Override
      public void onBatchScanResults(List&lt;ScanResult&gt; results) {
          super.onBatchScanResults(results);
          dialog.dismiss();
          for(ScanResult result:results) {
              Toast.makeText(MainActivity.this, "Hey I found BLE device" + result.toString(), Toast.LENGTH_LONG).show();
          }
      }
  
      @Override
      public void onScanFailed(int errorCode) {
          super.onScanFailed(errorCode);
  
          if(errorCode==1) {
              Toast.makeText(MainActivity.this, "Scan is already started" + errorCode, Toast.LENGTH_LONG).show();
          }else if(errorCode==3)
          {
              Toast.makeText(MainActivity.this, "Scan is interrupted due to internal error" + errorCode, Toast.LENGTH_LONG).show();
          }else{
              Toast.makeText(MainActivity.this, "Unexpected error" + errorCode, Toast.LENGTH_LONG).show();
          }
      }
  };
  }
  </code></pre>
  
  <p>Thank you.</p>