<?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>How to auto reconnect to BLE in android when it is in range and starts advertising?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/4513/how-to-auto-reconnect-to-ble-in-android-when-it-is-in-range-and-starts-advertising</link><description>I am develop in Android BLE , I have no idea about Auto reconnect to BLE device in android when it is in range and starts advertising 
 I have reference the Android BLE Connect. The second parameter for autoConnect in mBluetoothGatt = device.connectGatt</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 03 Dec 2014 10:36:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/4513/how-to-auto-reconnect-to-ble-in-android-when-it-is-in-range-and-starts-advertising" /><item><title>RE: How to auto reconnect to BLE in android when it is in range and starts advertising?</title><link>https://devzone.nordicsemi.com/thread/16012?ContentTypeID=1</link><pubDate>Wed, 03 Dec 2014 10:36:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e96891e4-10eb-420c-a2ff-1ca13171d02d</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Wen,&lt;/p&gt;
&lt;p&gt;I assume you wanted to write &amp;quot;when device disconnect, i execute gatt.close(), gatt.disconnect...&amp;quot; not when the device connect ?
You should not do that.&lt;/p&gt;
&lt;p&gt;Actually you can simply test using the sample provided on Android website: &lt;a href="http://developer.android.com/samples/BluetoothLeGatt/index.html"&gt;developer.android.com/.../index.html&lt;/a&gt;
And change autoconnect from false to true in connect() function in BluetootLEService.java after that the app will auto reconnect when the device back in range.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to auto reconnect to BLE in android when it is in range and starts advertising?</title><link>https://devzone.nordicsemi.com/thread/16009?ContentTypeID=1</link><pubDate>Fri, 21 Nov 2014 01:39:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5cfa096e-ed58-4640-af67-0777aa2f2059</guid><dc:creator>wen</dc:creator><description>&lt;p&gt;I have try , it seems didn&amp;#39;t work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to auto reconnect to BLE in android when it is in range and starts advertising?</title><link>https://devzone.nordicsemi.com/thread/16008?ContentTypeID=1</link><pubDate>Thu, 20 Nov 2014 20:25:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f87b9be-eec8-4194-aead-5e4afbb42a7a</guid><dc:creator>wlgrd</dc:creator><description>&lt;p&gt;I haven&amp;#39;t touched android development, but it sounds like you should not do &lt;code&gt;gatt = null&lt;/code&gt; if you want to reconnect.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to auto reconnect to BLE in android when it is in range and starts advertising?</title><link>https://devzone.nordicsemi.com/thread/16011?ContentTypeID=1</link><pubDate>Thu, 20 Nov 2014 01:41:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1fedccd6-f3fc-45ab-872a-5825ee8d92de</guid><dc:creator>wen</dc:creator><description>&lt;p&gt;when Device connect , I execute gatt.close() , gatt.disconnect , gatt = null. Is these code affect to the reconnect ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to auto reconnect to BLE in android when it is in range and starts advertising?</title><link>https://devzone.nordicsemi.com/thread/16010?ContentTypeID=1</link><pubDate>Wed, 19 Nov 2014 16:10:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77583f76-46fe-48dc-899a-2c86b2faf8fb</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Wen,&lt;/p&gt;
&lt;p&gt;It should work that way. Have you make sure you didn&amp;#39;t do anything else when the device disconnected?
I heard that on some Android phone the function didn&amp;#39;t work properly. Which phone are you testing ?&lt;/p&gt;
&lt;p&gt;You can actually test this function using the nRF Master Control panel. There is a dropdown menu next to the Connect button where you can select &amp;quot;Connect with autoConnect&amp;quot;.
In my test here with the galaxy S4, the app automatically connect back when the nRF51 is turned on and advertising again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>