<?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/"><channel><title>What to keep in mind when developing your BLE Android app</title><link>/nordic/nordic-blog/b/blog/posts/what-to-keep-in-mind-when-developing-your-ble-andr</link><description>BLE is native supported on Android from v4.3. It has been continuously improved as Android evolving. It&amp;#39;s getting more and more complex with additional features. It&amp;#39;s important that a Bluetooth app should work smoothly on all Android versions, from 4</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><item><title>RE: What to keep in mind when developing your BLE Android app</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/what-to-keep-in-mind-when-developing-your-ble-andr</link><pubDate>Mon, 15 Jan 2018 05:51:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d70b6989-8b96-4da7-8fd3-efb391f0c3a2</guid><dc:creator>ajay</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Excellent! Thanks to Nordic Team. This just comeup at the right time&lt;/p&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=1147&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: What to keep in mind when developing your BLE Android app</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/what-to-keep-in-mind-when-developing-your-ble-andr</link><pubDate>Tue, 25 Apr 2017 01:20:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d70b6989-8b96-4da7-8fd3-efb391f0c3a2</guid><dc:creator>Aleksander Nowakowski</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Thanks again Emil! From my side I&amp;#39;ll just add that nRF Connect 4.11 is using connectGatt method with 4 parameters (transport set to LE) since v 4.11. I&amp;#39;m using reflections on Android 4.4-5.1, where this method was hidden. On 4.3 it was not accessible.&lt;/p&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=1147&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: What to keep in mind when developing your BLE Android app</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/what-to-keep-in-mind-when-developing-your-ble-andr</link><pubDate>Thu, 13 Apr 2017 21:07:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d70b6989-8b96-4da7-8fd3-efb391f0c3a2</guid><dc:creator>Aleksander Nowakowski</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;As far as i know the snoop log is now available when you do &amp;quot;Take bug report&amp;quot;.&lt;/p&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=1147&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: What to keep in mind when developing your BLE Android app</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/what-to-keep-in-mind-when-developing-your-ble-andr</link><pubDate>Thu, 13 Apr 2017 20:29:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d70b6989-8b96-4da7-8fd3-efb391f0c3a2</guid><dc:creator>Igor Ganapolsky</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;When you say:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;check Android&amp;#39;s Bluetooth HCI snoop log&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;how do you do that on Nougat phones?  I find it almost impossible to access that directory if you&amp;#39;re not rooted.&lt;/p&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=1147&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: What to keep in mind when developing your BLE Android app</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/what-to-keep-in-mind-when-developing-your-ble-andr</link><pubDate>Sat, 11 Mar 2017 20:48:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d70b6989-8b96-4da7-8fd3-efb391f0c3a2</guid><dc:creator>Valium123</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Include the pairing process too especially when you read characteristics that are encrypted.&lt;/p&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=1147&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: What to keep in mind when developing your BLE Android app</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/what-to-keep-in-mind-when-developing-your-ble-andr</link><pubDate>Fri, 02 Dec 2016 19:39:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d70b6989-8b96-4da7-8fd3-efb391f0c3a2</guid><dc:creator>Aleksander Nowakowski</dc:creator><slash:comments>0</slash:comments><description>&lt;blockquote&gt;
&lt;p&gt;Why do you think public addresses are super rare? Just because Nordic&amp;#39;s softdevice defaults to a static random address doesn&amp;#39;t mean other stacks do the same ;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I just assumed, that if you produce thousands of devices it is much easier to use random addresses then register them. But in fact i have no idea. Maybe for central devices it is better to ensure uniqueness, also don&amp;#39;t know.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;And the simple answer to the Google employee&amp;#39;s question &amp;quot;how could someone have a random address without scanning?&amp;quot; is simply that for example a static random address may definitely be known beforehand.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Of course there are a lot of options, like simply saving it in the app from last connection. But from the stack perspective, after resetting Bluetooth, is a new, unknown one. The solution should be to add the address type flag, not assume anything. But for now, until it&amp;#39;s fixed, something has to be decided or calculated heuristicaly.&lt;/p&gt;
&lt;p&gt;Very interesting finding about the random address and autoConnect. I&amp;#39;ll take a deeper look on Monday. Have a pleasant weekend and thanks again. I feel sorry for those who will read this ;)&lt;/p&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=1147&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: What to keep in mind when developing your BLE Android app</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/what-to-keep-in-mind-when-developing-your-ble-andr</link><pubDate>Fri, 02 Dec 2016 17:07:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d70b6989-8b96-4da7-8fd3-efb391f0c3a2</guid><dc:creator>Aleksander Nowakowski</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Hi, thanks for the long comment. Here&amp;#39;s my reply:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;I have fixed chapter numbering. It was broken when the document got the Nordic&amp;#39;y look&amp;amp;feel and no one noticed. Sorry!&lt;/li&gt;
&lt;li&gt;I had some problems with the URL with double slash as Word apparently &amp;quot;fixes&amp;quot; the URL to have just one, but &amp;quot;/-/&amp;quot; trick works. Also not quite my fault, except I did not notice. Also is fixed now.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&amp;quot;In chapter 3, connecting to a BLE device using an address directly, as of Android Nougat it is no longer true that it will assume it is a public address. It varies between Android builds but it sometimes set the bit to random address.&amp;quot;&lt;/em&gt; - my source in Google says it&amp;#39;s still a thing. How do you know it varies between builds? Are you talking about the different public 7.1-betas or something more internal?&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&amp;quot;I wonder about the sentence &amp;quot;the logic being that random addresses can change any time, and if it is hardcoded, it must be a public one&amp;quot;. Is that something someone at Google has confirmed or is that just an assumption? Actually I think this is an afterthought when they added BLE support since they didn&amp;#39;t need to care about address type before. There are still other bugs where they mess up with the address type in their code...&amp;quot;&lt;/em&gt; - I got this information from Google and it seems logical. If an app wants to connect to a BLE device that has never (since Bluetooth restart) been scanned before and it knows the address, it most probably mean that it&amp;#39;s a public address, despite the fact that public addresses are super rare, as I can imagine. Here&amp;#39;s what I got:&lt;/li&gt;
&lt;/ol&gt;
&lt;blockquote&gt;
&lt;p&gt;Message received 5 Oct 2016: Only the MAC address is used to identify a device (no type). When an address is passed to lower levels in C, the system tries to match it with a security record which contains the address type. If such record does not exist a PUBLIC address is assumed - how could someone have a random address without scanning? It&amp;#39;s a known problem and fixing it is in our backlog. Currently the best way to connect is to scan and use the returned BluetoothDevice object. Mind, that the security record is forgotten when Bluetooth adapter is restarted (unless it&amp;#39;s a PUBLIC address or the device is bonded).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Since then I also got the information, that in OOB pairing using NFC the address type encoded in the NFC message is also ignored in Android 7.1. The fix has already been made on AOSP and will be available in Android 7.2, or whatever comes next.&lt;/p&gt;
&lt;ol start="5"&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;Also, a third condition is that it also works without the need to scan before if the device is bonded (I&amp;#39;ve tested static random addresses and public addresses, not sure about random resolvable addresses)&amp;quot;&lt;/em&gt; - true, I added &lt;em&gt;The device has a PUBLIC address &lt;strong&gt;or is bonded&lt;/strong&gt;, or&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;It definitely attempts to connect to this device (with a HCI LE Create Connection). The only difference regarding that is that the address is provided by the white list instead of in the HCI LE Create Connection command. Also the standard configuration (which may be different between Android phone vendors) is to use more active scanning parameters when using autoConnect=false which leads to faster connection setups.&amp;quot;&lt;/em&gt; - as far as I remember in a test I made using a BLE sniffer, when I was trying to connect to an advertising HTC One M8 phone form a Nexus with autoConnect=true, there was no Connection Req at all. However, this chapter based only on my experience so I will change it to what you wrote. Thank you.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;There are more differences:.[...]&amp;quot;&lt;/em&gt; - let me just copy the whole paragraph to the PDF :) Although, as you wrote in the second URL, the race condition is now fixed.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;Regarding older devices where overflow is not handled well, as well as on iOS, an easy workaround is to send each 15th packet or so as a Write With Response. Then you don&amp;#39;t need to create any special acknowledgement logic on the peripheral side. It of course reduces speed a bit, but rather that than dropped packets.&amp;quot;&lt;/em&gt; - Nice idea. Added to the PDF.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;In chapter 4.5. With Qualcomm Bluetooth chips, that is used in for example Nexus 5X, I&amp;#39;ve measured 12 packets per connection event.&amp;quot;&lt;/em&gt; - wow, that&amp;#39;s hell of a chip. Almost as good as Nordic&amp;#39;s :)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;When referring to particular lines in Android source code, link to a specific commit rather than master. Otherwise the links will soon not be valid anymore. If you link to a file as a whole I guess you may link to a file in the master branch however.&amp;quot;&lt;/em&gt; - true... usually I gave a commit link + link to the &lt;em&gt;most recent version&lt;/em&gt;. But it is true they may change.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;There are some race conditions in the Android SDK if you call methods too quickly after each other. See &lt;a rel="nofollow" target="_blank" href="https://code.google.com/p/android/issues/detail?id=223582"&gt;code.google.com/.../detail&lt;/a&gt;. If you need to have stable long-running connectivity to Android devices you should avoid restarting advertising immediately after a connection loss but rather wait a small time in between to prevent that the Android stack hangs. See &lt;a rel="nofollow" target="_blank" href="https://code.google.com/p/android/issues/detail?id=219910.&amp;quot;"&gt;code.google.com/.../detail&lt;/a&gt;&lt;/em&gt; - yes, adding delays help. If you check the source code for the Android DFU library I add a lot of those. For some devices it&amp;#39;s enough to run a method from UI thread (I assume the small delay is enough, doesn&amp;#39;t have to be the UI thread)&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Thanks again for your long response. I&amp;#39;ll update the PDF next week.&lt;/p&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=1147&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: What to keep in mind when developing your BLE Android app</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/what-to-keep-in-mind-when-developing-your-ble-andr</link><pubDate>Fri, 02 Dec 2016 15:46:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d70b6989-8b96-4da7-8fd3-efb391f0c3a2</guid><dc:creator>Hung Bui</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Thanks a lot Emil for your detailed feedback !! I will forward your comment to our developer. We will udpate the document shortly and I will let you know when we do that.&lt;/p&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=1147&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: What to keep in mind when developing your BLE Android app</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/what-to-keep-in-mind-when-developing-your-ble-andr</link><pubDate>Mon, 28 Nov 2016 13:20:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d70b6989-8b96-4da7-8fd3-efb391f0c3a2</guid><dc:creator>Hung Bui</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Unfortunately, we don&amp;#39;t have a guide now for iOS but we are considering to do one.&lt;/p&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=1147&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: What to keep in mind when developing your BLE Android app</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/what-to-keep-in-mind-when-developing-your-ble-andr</link><pubDate>Sat, 26 Nov 2016 14:57:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d70b6989-8b96-4da7-8fd3-efb391f0c3a2</guid><dc:creator>Torfinn Berset</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Thanks for this very useful document! Is there an equivalent document for iOS, or is there one planned? We are developing our BLE sensor for both iOS and Android and these insights help tremendously.&lt;/p&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=1147&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: What to keep in mind when developing your BLE Android app</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/what-to-keep-in-mind-when-developing-your-ble-andr</link><pubDate>Sun, 20 Nov 2016 18:13:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d70b6989-8b96-4da7-8fd3-efb391f0c3a2</guid><dc:creator>Yacire</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Excellent! Thanks to Nordic Team.&lt;/p&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=1147&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: What to keep in mind when developing your BLE Android app</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/what-to-keep-in-mind-when-developing-your-ble-andr</link><pubDate>Thu, 17 Nov 2016 19:09:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d70b6989-8b96-4da7-8fd3-efb391f0c3a2</guid><dc:creator>F800</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Thank you.    Truly helpful.&lt;/p&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=1147&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: What to keep in mind when developing your BLE Android app</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/what-to-keep-in-mind-when-developing-your-ble-andr</link><pubDate>Tue, 15 Nov 2016 12:54:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d70b6989-8b96-4da7-8fd3-efb391f0c3a2</guid><dc:creator>Luis</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Very useful document! Thanks for sharing!&lt;/p&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=1147&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>