<?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 code with autoconnect implemented</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/24873/android-code-with-autoconnect-implemented</link><description>Hi,
I am planning to enable autoconnect feature in our app, the same way it is done in nrf-connect app. Is there any way to get the code for nrf-connect app or any other app with autoconnect implemented. 
 Or some documentation where I can find how</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 08 Sep 2017 09:40:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/24873/android-code-with-autoconnect-implemented" /><item><title>RE: Android code with autoconnect implemented</title><link>https://devzone.nordicsemi.com/thread/97964?ContentTypeID=1</link><pubDate>Fri, 08 Sep 2017 09:40:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9edf0b3-dae8-412c-b41e-e7cba58a9831</guid><dc:creator>Aleksander Nowakowski</dc:creator><description>&lt;p&gt;You can&amp;#39;t call &lt;code&gt;gatt.close()&lt;/code&gt; when it disconnects as this will release the gatt object.
Also, the first connection should be with autoConnect=false, as it&amp;#39;s much faster (active connection). When you get a callback onConnectionStateChange with State disconnected you there call gatt.connect() which (if you check the source code) will use true since then.
We recommend using the BleManager class from nRF Toolbox. It handles it and common errors automatically.
Source code for nRF Toolbox is on GitHub, for nRF Connect is not public.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android code with autoconnect implemented</title><link>https://devzone.nordicsemi.com/thread/97962?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 16:56:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5560b778-11cf-43ab-94b0-1614eed506ec</guid><dc:creator>vineeshvs</dc:creator><description>&lt;p&gt;It works with nRf connect. Then it should work in our app also if implemented in the same phone right? We are in the autoconnect logic. What should be the logic in implementing autoconnect? Which all functions we need to call and in what order? Any help is appreciated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android code with autoconnect implemented</title><link>https://devzone.nordicsemi.com/thread/97961?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 07:00:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56c8b973-b746-4c1a-b44a-cbbf66bf868d</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;And it works with nRF Connect? Apparently some phones do not support autoconnect, see &lt;a href="https://devzone.nordicsemi.com/question/64949/autoconnect-with-ble_app_proximity-master-control-paneltoolbox/"&gt;this&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android code with autoconnect implemented</title><link>https://devzone.nordicsemi.com/thread/97963?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 03:45:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d14c606f-0b3b-47d0-b332-db382fcd3c64</guid><dc:creator>vineeshvs</dc:creator><description>&lt;p&gt;I have already tried making autoconnect = true. Still it is now working. Once disconnected, it&amp;#39;s not connecting back&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android code with autoconnect implemented</title><link>https://devzone.nordicsemi.com/thread/97960?ContentTypeID=1</link><pubDate>Tue, 05 Sep 2017 11:36:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad9ce847-1d4b-40e6-b2d3-5c8d43ad9856</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;I&amp;#39;m not an Android expert, but this seems to be a bool you set when you call [connectGatt()](&lt;a href="https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#connectGatt(android.content.Context"&gt;developer.android.com/.../BluetoothDevice.html&lt;/a&gt;, boolean, android.bluetooth.BluetoothGattCallback))?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>