title: Android: Bluetooth LE onLeScan() is not called
body: <p>I am Creating an application availing BLE for API 18 or higher.I have implemented BluetoothAdapter.LeScanCallBack methode but ;bluetootAdppter.StartLeScan(this)' is not calling @override onLeScan(.. , .. ,..) methode.I have searched across whole google but none solution has solved my problem yet.Please Help me
  I have Tested this on SamsungGrand 2 and Samsung NOTE3 ..Thanks</p>
  
  <pre><code>public class DeviceScanActivity extends Activity implements BluetoothAdapter.LeScanCallback 
  {
      private BluetoothAdapter mBluetoothAdapter;
      private boolean mScanning;
      private Handler mHandler;
  
      private static final long SCAN_PERIOD = 10000;
      // private LeDeviceListAdapter mLeDeviceListAdapter;
      private ArrayList&lt;BluetoothDevice&gt; alBlDevices;
      private ArrayList&lt;String&gt; alDevicesNames;
      BluetoothDevice tmpDevice;
      LinearLayout lllist;
  
      private BluetoothManager bluetoothManager;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_device_scan);
          initData();
          initUI();
      }
  
      private void initData() {
          bluetoothManager = (BluetoothManager) getSystemService(getApplicationContext().BLUETOOTH_SERVICE);
          mBluetoothAdapter = bluetoothManager.getAdapter();
  
          mHandler = new Handler();
          alBlDevices = new ArrayList&lt;BluetoothDevice&gt;();
  
      }
  
      private void initUI() {
          lllist = (LinearLayout) findViewById(R.id.llList);
          Toast.makeText(getApplicationContext(), "initUI()", Toast.LENGTH_LONG)
                  .show();
          scanLeDevice(true);
  
      }
  
      private void scanLeDevice(final boolean enable) {
          if (enable) {
              Toast.makeText(getApplicationContext(), "START SCANNING",
                      Toast.LENGTH_LONG).show();
              // Stops scanning after a pre-defined scan period.
  
              /*
               * mHandler.postDelayed(new Runnable() {
               * 
               * @Override public void run() { mScanning = false;
               * mBluetoothAdapter.stopLeScan(mLeScanCallback);
               * 
               * } }, SCAN_PERIOD);
               */
  
              mScanning = true;
  
              mBluetoothAdapter.startLeScan(this);
          } else {
              mScanning = false;
              mBluetoothAdapter.stopLeScan(this);
          }
  
      }
  
  
  
      @Override
      public void onLeScan(BluetoothDevice device, int rssi, byte[] f) 
      {
  
          Toast.makeText(getApplicationContext(), "HHHHH&gt;", Toast.LENGTH_LONG)
                  .show();
          tmpDevice = device;
  
          alBlDevices.add(tmpDevice);
          alDevicesNames.add(tmpDevice.getName());
          Toast.makeText(getApplicationContext(),
                  "scanning&gt;" + tmpDevice.getName(), Toast.LENGTH_LONG).show();
  
          runOnUiThread(new Runnable() 
          {
              @Override
              public void run() {
  
                  LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
                  View tvView = inflater.inflate(R.layout.tv_single_device, null);
                  ((TextView) tvView.findViewById(R.id.textView1))
                          .setText(alDevicesNames.get(alDevicesNames.size() - 1));
                  lllist.addView(tvView);
                  Log.v("Tag", tmpDevice.getName());
              }
          });
      }
  
  }
  </code></pre>
  
  <p>..</p>
  
  <p>logCat:</p>
  
  <pre><code>    05-08 10:46:06.373: E/ViewSystem(7019): ViewRootImpl #2 Surface is not valid.
  05-08 10:46:06.443: D/dalvikvm(7019): GC_FOR_ALLOC freed 707K, 34% free 9276K/13920K, paused 15ms, total 15ms
  05-08 10:46:06.468: D/BluetoothAdapter(7019): startLeScan(): null
  05-08 10:46:06.483: D/BluetoothAdapter(7019): onClientRegistered() - status=0 clientIf=4
  05-08 10:46:06.528: D/libEGL(7019): loaded /vendor/lib/egl/libGLES_mali.so
  05-08 10:46:06.533: I/(7019): PLATFORM VERSION : JB-MR-2
  05-08 10:46:06.548: D/mali_winsys(7019): new_window_surface returns 0x3000
  05-08 10:46:06.563: D/OpenGLRenderer(7019): Enabling debug mode 0
  </code></pre>