<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Android BLE library - autoconnect</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75468/android-ble-library---autoconnect</link><description>We have developed an Android application for a customer (Ibiza) which makes use of nRF&amp;#39;s Android-BLE-Library ( https://github.com/NordicSemiconductor/Android-BLE-Library ). The app is based off the Android-nRF-Blinky app ( https://github.com/NordicSemiconductor</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 26 May 2021 06:06:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75468/android-ble-library---autoconnect" /><item><title>RE: Android BLE library - autoconnect</title><link>https://devzone.nordicsemi.com/thread/311636?ContentTypeID=1</link><pubDate>Wed, 26 May 2021 06:06:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4183ce9-9cf6-4ccc-8a96-a45475fb82b9</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Vignesh, I have some insights from the developer.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;The auto connect feature on Android is slow, as it is offloaded to ble controller, which may save power and scan only periodicity. There are, or were, also some issues regarding the address type: public or random, when connecting to a device which has not been scanned found at least once done Bluetooth was enabled. As the Mac address in Android API is 48 bits long, the address type is either taken from security record (if an address has been scanned at least once), or assumed public, if it hasn&amp;#39;t. But let&amp;#39;s say, the device was found during ble scan, and its type is known.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;When the device is in range, it&amp;#39;s much better to connect without auto-connect, as it&amp;#39;s much faster.&amp;nbsp;It a user want to connect to a device that&amp;#39;s out of range using auto-connect, the correct way to do this is too start scanning (preferably using new API with Pending Intent, available in Android 8+), which is battery efficient, and when a device is found than connecting to it using ble library seeing auto-connect to true. Then we may be almost confident the device is in range. The retry at in connect API in ble library doesn&amp;#39;t retry in case of timeout, as far as i remember. It just &amp;quot;solves&amp;quot; other connection issues, like error 133 (which occurs before 30 sec after connection attempt) (133 thrown 30 after connection attempt is started should be treated as timeout).&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;So, basically, retry won&amp;#39;t help in this case, unless connection with auto-connect ends with errors. Instead, i recommend background scanning. Android Scanner Compat library tries to emulate new API with Pending Intent using background service in pre-Oreo (Android 8) devices. It&amp;#39;s not that efficient, but should also work. Per-lollypop Android should not scan with large scan window (also can be adjusted in Scanner Compat library).&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Hope this helps.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android BLE library - autoconnect</title><link>https://devzone.nordicsemi.com/thread/311571?ContentTypeID=1</link><pubDate>Tue, 25 May 2021 15:47:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f9cf7a3d-43fa-4f93-bc15-3f937f679b7c</guid><dc:creator>vignesh-mpc</dc:creator><description>&lt;p&gt;Hi Susheel, any updates here?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android BLE library - autoconnect</title><link>https://devzone.nordicsemi.com/thread/311147?ContentTypeID=1</link><pubDate>Fri, 21 May 2021 21:51:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3a9ef80-6b0c-408d-bee2-9e4d78fce27b</guid><dc:creator>vignesh-mpc</dc:creator><description>&lt;p&gt;Done. Thanks and looking forward to your response!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android BLE library - autoconnect</title><link>https://devzone.nordicsemi.com/thread/311146?ContentTypeID=1</link><pubDate>Fri, 21 May 2021 07:59:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7cb7092c-c907-46ef-be5b-58c3303b3684</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I can request our Android expert to take a look at it if you can make this case public (in private I cannot share full details with him)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android BLE library - autoconnect</title><link>https://devzone.nordicsemi.com/thread/311145?ContentTypeID=1</link><pubDate>Thu, 20 May 2021 15:35:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e5e21ce-93d1-474d-b7f2-44e386bd3dc5</guid><dc:creator>vignesh-mpc</dc:creator><description>&lt;p&gt;Susheel, thanks for your response, we will try that out as well. Would you be able to direct us to someone that might know more about the intricacies of this Nordic Android BLE library, and help us deliver a more robust product? Or if you have any experiences you can share from other customers that have used this library, that would be greatly appreciated as well. Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android BLE library - autoconnect</title><link>https://devzone.nordicsemi.com/thread/311144?ContentTypeID=1</link><pubDate>Wed, 19 May 2021 07:01:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3802bc4-d551-4f8d-86df-88f7089e926b</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I am not an expert in the Android app side but probably increase the retry count in that bleManager.connect to see if that increases the probability of reconnect?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>