<?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>nrf52dk and nrf connect, Autoconnect after bluetooth adapter turned off and on</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/45487/nrf52dk-and-nrf-connect-autoconnect-after-bluetooth-adapter-turned-off-and-on</link><description>Hi, 
 I tried nrf connect and nrf hrs example. I used nrf52DK. I bonded the device, and connected with autoconnect. I turned off the nrf 52 DK, and turn on. The nrf connect app on the phone can saw the state when disconnect, and can reconnected after</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 02 Apr 2019 08:23:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/45487/nrf52dk-and-nrf-connect-autoconnect-after-bluetooth-adapter-turned-off-and-on" /><item><title>RE: nrf52dk and nrf connect, Autoconnect after bluetooth adapter turned off and on</title><link>https://devzone.nordicsemi.com/thread/179676?ContentTypeID=1</link><pubDate>Tue, 02 Apr 2019 08:23:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84380c1d-9279-42c3-8033-cc06eb91ef5d</guid><dc:creator>Kovacs.janos256</dc:creator><description>&lt;p&gt;So the Android-BLE-Library doesn&amp;#39;t manage this situation? In the Android-BLE-Library i see it listens to the Bluetooth ON broadcast. So whats tasks/responsibilities the Android-BLE-Library&amp;#39;s autoconnect feature?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52dk and nrf connect, Autoconnect after bluetooth adapter turned off and on</title><link>https://devzone.nordicsemi.com/thread/179501?ContentTypeID=1</link><pubDate>Mon, 01 Apr 2019 12:45:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65e22176-4ae7-4fc6-a660-8a89f479e319</guid><dc:creator>Aleksander Nowakowski</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;This behavior is intended. The &amp;#39;autoConnect&amp;#39; feature works until you call &amp;#39;close()&amp;#39; method on the BluetoothGatt object. Turning off Bluetooth on the phone closes all GATT (BluetoothGatt) objects, so the phone forgets which device was connected, which not, etc.&lt;/p&gt;
&lt;p&gt;In order to make it work like you&amp;#39;d like, you have to listen to the Bluetooth ON broadcast and call connectGatt with parameter autoConnect=true again. However, if your device is not bonded and uses a private Bluetooth address, you need to scan for it before connecting, otherwise the phone will expect public address and the connection attempt will fail (system will scan for an adv packet for a device advertising with the same 48-bit address, but with 49th bit set to public). Scanning in your app will ensure that the system saves the address and its type when it&amp;#39;s found.&lt;/p&gt;
&lt;p&gt;As I wrote in the other post, if you also want to automatically connect after the phone gets reboot, you need additionally listen to ACTION_BOOT_COMPLETE broadcast.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52dk and nrf connect, Autoconnect after bluetooth adapter turned off and on</title><link>https://devzone.nordicsemi.com/thread/179444?ContentTypeID=1</link><pubDate>Mon, 01 Apr 2019 10:16:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6989de4-945f-46e1-8035-7b14fb4eb237</guid><dc:creator>Kovacs.janos256</dc:creator><description>&lt;p&gt;I tried with your official apps and tools, and its not work. Please try the nrf connect app, and the nrf hrs example app in sdk. The nrf connect uses Android-BLE-Library.&lt;br /&gt;My steps:&lt;br /&gt;1. I bonded the device in nrf connect&lt;br /&gt;2. I Connected with autoconnect in the nrf connect app.&lt;br /&gt;3. I turned off the nrf 52 DK, and turn on. The nrf connect app on the phone can saw the state when disconnect, and can reconnected after some seconds, so the autoconnect feature worked.&lt;br /&gt;4. But if when connected together, (phone writes: connected) i turned off the bluetooth adapter (the app wrote bluetooth adapter not turned on, and device state&lt;br /&gt;is changed to disconnected), and turned on the bluetooth adapter on my phone (the program not wrote the bluetooth adapter off error), and wait, but the&lt;br /&gt;phone not connect automaticaly to nrf 52 DK. If i push the connect button, its working.&lt;br /&gt;5. So auto connect feature not work properly. If i turn off and on the dev kit, autoconnect works, but if i turn off and on the phones bluetooth adapter,&lt;br /&gt;nrf connect app not reconnect automaticaly.&lt;br /&gt;So i write relevant parts of my code, but not work the lib autoconnect function in your nrf connect official app too.&lt;br /&gt;So its trivial, if the lib autoconnect feature not working properly in your official apps, then in my app, not working as expected...&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br /&gt;Janos&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52dk and nrf connect, Autoconnect after bluetooth adapter turned off and on</title><link>https://devzone.nordicsemi.com/thread/179205?ContentTypeID=1</link><pubDate>Fri, 29 Mar 2019 11:29:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17990ec1-6493-491e-8bfe-8a0442631605</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Janos,&lt;/p&gt;
&lt;p&gt;This should be in order if you use the&amp;nbsp;Android-BLE-Library and set autoConnect set to true when you connect, and this is not the first connection. It is not clear to me if/how you have done this. Can you show us the relevant parts of your code?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52dk and nrf connect, Autoconnect after bluetooth adapter turned off and on</title><link>https://devzone.nordicsemi.com/thread/179195?ContentTypeID=1</link><pubDate>Fri, 29 Mar 2019 10:58:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96b53526-c744-4463-aa25-1600e5db7213</guid><dc:creator>Kovacs.janos256</dc:creator><description>&lt;p&gt;Thanks the suggestion. But your linked post writes:&lt;/p&gt;
&lt;p&gt;&amp;quot;* We recommend using BLE Library (&lt;br /&gt;&lt;a href="https://github.com/NordicSemiconductor/Android-BLE-Library/"&gt;https://github.com/NordicSemiconductor/Android-BLE-Library/)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;as it handles some of those automatically.&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I using this lib, and has a feature, &amp;quot;autoconnection&amp;quot;. But its not work properly.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t want implement the feature again manualy and rewrite my app, if the autoconnection has in the lib.&lt;/p&gt;
&lt;p&gt;My suggestion is please forward the ticket to a technical team. Thanks for your help.&lt;/p&gt;
&lt;p&gt;Janos&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52dk and nrf connect, Autoconnect after bluetooth adapter turned off and on</title><link>https://devzone.nordicsemi.com/thread/179169?ContentTypeID=1</link><pubDate>Fri, 29 Mar 2019 09:48:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a98d45e-8d98-46ff-9a32-d80357b6abce</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Janos,&lt;/p&gt;
&lt;p&gt;You have to implement autoconnection after toggling Bluetooth or airplane mode yourself, but it is not complicated. Please refer to &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/44295/nrf-connect-app-and-autoconnect/174068#174068"&gt;this excellent post&lt;/a&gt; for details.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52dk and nrf connect, Autoconnect after bluetooth adapter turned off and on</title><link>https://devzone.nordicsemi.com/thread/178965?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2019 14:01:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d16b5726-d630-4f2b-8c05-0e52f882710c</guid><dc:creator>Kovacs.janos256</dc:creator><description>&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52dk and nrf connect, Autoconnect after bluetooth adapter turned off and on</title><link>https://devzone.nordicsemi.com/thread/178941?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2019 10:53:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:832ecc47-b8d5-4be5-a9f4-cf1df11ecce4</guid><dc:creator>Kovacs.janos256</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;I using bonding, and the autoconnect feature not work with bluetooth off and on, and airplane mode. And the nrf hrs example using bonding too, but not working as expected, not reconnect automaticaly if i toggle airplane mode or bluetooth. But i bonded the nrf52dk with the phone, and not working. I tried my custom app, but i tried with nrf connect app too, and not working. Whats the problem? I using bonding. I connect with autoconnect=true. Why not reconnect after toggling bluetooth or airplane mode? Can you give a try with an nrf 52 dk and your phone, with nrf connect app? Try to bond, and connect with autoconnect. If you take the device out of range, the phone can connect after found the nrf52 dk, but if you toggle bluetooth or airplane mode, the phone not connect back automaticaly, you need to push to connect button. I think this is a bug in the nrf ble lib. You sayd the lib support this feature, and i see the broadcastReceiver in the lib, which can tell the lib if the bluetooth state changes. So if the lib supports this feature, and i use bonding, and connect with autoconnect=true, why not work?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br /&gt;Janos&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52dk and nrf connect, Autoconnect after bluetooth adapter turned off and on</title><link>https://devzone.nordicsemi.com/thread/178940?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2019 10:28:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4605d9c-aa99-4213-8f95-81d78f85dd2a</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Janos,&lt;/p&gt;
[quote user="Kovacs.janos256"]The autoconnection depends bonding, or not?[/quote]
&lt;p&gt;You have to use bonding in this case. If you don&amp;#39;t use bonding, then this is expected behavior. The android phone will typically flush all Bluetooth related information when you toggle airplane mode, and then it will not have any information about which to reconnect to. So the proper way to fix this is to use bonding.&lt;/p&gt;
[quote user="Kovacs.janos256"]How can i get more information about my phones connection handling mechanics?[/quote]
&lt;p&gt;It might be better to ask in a Android forum for Android specific questions, or contact the phone manufacturer for very specific questions related to specific devices. (This does not seem relevant here though, if the problem is just that you are not using bonding.).&lt;/p&gt;
[quote user="Kovacs.janos256"]Can you give me more information about autoconnection, and the nordic lib autoconnection feature?[/quote]
&lt;p&gt;There is not much more to say. It will auto connect, but not to non-bonded devices when you toggle airplane mode. I do not believe that is possible. You could however expand your app to scan in the background and connect to the device. Then it would not really be automatically, but you could probably implement this in your app so that it seems automatic for the user.&lt;/p&gt;
&lt;p&gt;Br,&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52dk and nrf connect, Autoconnect after bluetooth adapter turned off and on</title><link>https://devzone.nordicsemi.com/thread/178939?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2019 08:39:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20475d57-c101-4a3e-84f5-db9a3e2fbb64</guid><dc:creator>Kovacs.janos256</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;I testing with android phones (Xiaomi Mi A1, and Google Pixel 2), and not works both.&lt;br /&gt;The Nordic android ble lib has feature autoconnect=true. In the lib code, i see, the device can autoconnect in the background, when i use autoconnect=true when i call connect(). It has a broadcastReceiver, which listen to bluetooth state, and manage it, so i think it can reconnect automaticaly, when i turned off bluetooth, and turned on again. The autoconnect works, when device out of range, but if modify the bluetooth state, the autoconnect not work. So i think the lib has a bug, or the lib has not contains this feature? I need to reconnect manualy in the background if the bluetooth adapter turning off and on? If its true, the autoconnect=true whats doing generaly? If i bond the phone with the device, the autoconnection feature works better, or not? The autoconnection depends bonding, or not?&lt;br /&gt;How can i get more information about my phones connection handling mechanics?&lt;br /&gt;Can you give me more information about autoconnection, and the nordic lib autoconnection feature?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br /&gt;Janos&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52dk and nrf connect, Autoconnect after bluetooth adapter turned off and on</title><link>https://devzone.nordicsemi.com/thread/178938?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2019 14:23:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:922e428f-4e05-4aea-a2c0-d65ce35e51aa</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Janos,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Are you testing with iOS or Android phones? Generally y&lt;/span&gt;&lt;span&gt;ou can connect automatically in the background if you are using your custom app. If not, then the OS will typically only automatically connect to devices that include a few specific services, such as for instance HID keyboard. This all depend on the phone, though. As long as the nRF peripheral advertises, then it is up to the phone to connect.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Br,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Einar&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>