title: Android Lollipop 5.0 Bluetooth Low Energy central role's bad performance
body: <p>Since the recent release of Android 5.0 Lollipop I am experiencing very bad performance of the Bluetooth Low Energy API in my Nexus 4 device. With the previous OS version (Android 4.4.4 Kit-Kat) it worked like a charm, and the very same app run on 5.0 has the following behavior:</p>
  
  <ol>
  <li><p>Frequently it does not detect any advertising packet from the peripheral.</p>
  
  <blockquote>
    <p>The <em>ADVERTISING_INTERVAL</em> of the peripheral is 20ms, so the app should detect at least one advertising in 60ms in the worst case. I have tried with <code>BluetoothLeScanner</code> (with <em>SCAN_MODE_LOW_LATENCY</em> settings) not to use the deprecated <code>mBluetoothAdapter.startLeScan(mLeScanCallback)</code> with no success.</p>
  </blockquote></li>
  <li><p>When it does, when I try to connect to the GATT server it rarely does.</p>
  
  <blockquote>
    <p>I have checked with a BLE sniffer that the <em>CONNECTION_REQUEST</em> packet
    is not even sent to the peripheral.</p>
  </blockquote></li>
  </ol>
  
  <p>It seems I'm not the only one with this kind of errors and some other users have posted <a href="https://stackoverflow.com/questions/27111309/decreased-ble-startscan-detected-devices-on-android-5-0-lollipop/27113787">similar questions</a>. Does anybody know what has happened?</p>
  
  <p>--</p>
  
  <p><strong>Update 1:</strong> <em>(2014/12/17)</em><br>
  I have also tested the same app with a Nexus 5 running Lollipop and it rarely connects to the GATT server. Every time I send a connection request, it never does because the peripheral does not receive the packet. Before upgrading this Nexus 5 to Lollipop, it worked perfectly on Kit-Kat 4.4.4 though.</p>
  
  <p><strong>Update 2:</strong> <em>(2014/12/17)</em><br>
  Android 5.0.1 does not solve the problem at all.</p>
  
  <p><strong>Update 3:</strong> <em>(2015/04/23)</em><br>
  Android 5.1 does not solve the problem either. Today I've had the opportunity to test Android 5.0.1 on a SAMSUNG Galaxy S4 and it works perfectly. I have also tested on the Nexus 5 with a fresh Android 5.1 install, and it works fine too. The problem still remains in the Nexus 4. They made something strange on the the firmware of Android 5.0 and subsequent releases that broke the perfect compatibility Android 4.4.4 had with the Bluetooth API.</p>