<?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>nRFToobox on Android not recognizing changes in application type running on Nordic pcb</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/4783/nrftoobox-on-android-not-recognizing-changes-in-application-type-running-on-nordic-pcb</link><description>Today nRF Toolbox App on my Android 5.0 phone is only recognizing HRM code running on my nRF5182-mkit, not other examples. 
 
 
 Today nRFToobox and nRFUART2.0 Apps both report &amp;quot;The Device Does not have the required services&amp;quot; when I try anything other</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 10 Jan 2017 10:11:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/4783/nrftoobox-on-android-not-recognizing-changes-in-application-type-running-on-nordic-pcb" /><item><title>RE: nRFToobox on Android not recognizing changes in application type running on Nordic pcb</title><link>https://devzone.nordicsemi.com/thread/16942?ContentTypeID=1</link><pubDate>Tue, 10 Jan 2017 10:11:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05b3a1d7-4cdd-47c3-b6d6-1256feca7c4b</guid><dc:creator>Anne van Rossum</dc:creator><description>&lt;p&gt;Yes, this is the case for the Samsung S5 (running Android 6.0.1). This is also the case for for example the Wiko Lenny 2 (Android 5.1, a very cheap device).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRFToobox on Android not recognizing changes in application type running on Nordic pcb</title><link>https://devzone.nordicsemi.com/thread/16941?ContentTypeID=1</link><pubDate>Tue, 10 Jan 2017 09:58:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27fa5d74-842a-4279-a2e5-122ccd301647</guid><dc:creator>Aleksander Nowakowski</dc:creator><description>&lt;p&gt;Interesting finding, I thought all Android devices just cache everything always. So you say Samsung doesn&amp;#39;t cache services of untrusted devices... I&amp;#39;ll need to look into it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRFToobox on Android not recognizing changes in application type running on Nordic pcb</title><link>https://devzone.nordicsemi.com/thread/16938?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 14:26:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be31f406-8b4c-4b6f-9d1b-23d33a78802e</guid><dc:creator>Anne van Rossum</dc:creator><description>&lt;p&gt;Exactly. That&amp;#39;s not the behavior I observe. On a Samsung S5 the cache will be refreshed even if there is no Service Changed characteristic present. Hence, there is no reliable way across smartphone-manufacturers to have low-latency connections to untrusted devices. There might or might not be a physical discovery process.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRFToobox on Android not recognizing changes in application type running on Nordic pcb</title><link>https://devzone.nordicsemi.com/thread/16936?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 11:48:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b25f736-34c4-432c-a0ed-60c5275e333d</guid><dc:creator>Aleksander Nowakowski</dc:creator><description>&lt;p&gt;Then the device is not allowed to change it&amp;#39;s database (services/characteristics/descriptors) at any time. Central device may use cache and may never clean it.
Spec 4.2 says: Note: Clients without a trusted relationship must perform service discovery on
each connection if the server supports the Service Changed characteristic. (Vol 3, Part G, 2.5.2)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRFToobox on Android not recognizing changes in application type running on Nordic pcb</title><link>https://devzone.nordicsemi.com/thread/16937?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 11:21:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af2cd2e0-e057-4862-84bc-c637eee3c343</guid><dc:creator>Anne van Rossum</dc:creator><description>&lt;p&gt;What should the behavior be for untrusted devices when the Service Changed characteristic is absent?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRFToobox on Android not recognizing changes in application type running on Nordic pcb</title><link>https://devzone.nordicsemi.com/thread/16940?ContentTypeID=1</link><pubDate>Sun, 08 Jan 2017 17:54:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b1eeeee-2c60-46d3-99d2-2dff01c7a2b6</guid><dc:creator>Aleksander Nowakowski</dc:creator><description>&lt;p&gt;Since some version ago nRF Connect doesn&amp;#39;t refresh cache automatically for devices running Android 6+. There this option there is gone in the settings. You may however do it manually by menu-&amp;gt;Refresh cache after you are connected.
The BLE spec clearly states when the cache should be used. For untrusted devices should never be used if Service Changed characteristic is present, like iOS does. Google knows is and works on a solution, but until then, and for all versions before the fix, refreshing using reflections seems to be the only solution.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRFToobox on Android not recognizing changes in application type running on Nordic pcb</title><link>https://devzone.nordicsemi.com/thread/16939?ContentTypeID=1</link><pubDate>Sun, 08 Jan 2017 15:44:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4d82794-78a6-43b3-a158-f224aad02b70</guid><dc:creator>Anne van Rossum</dc:creator><description>&lt;p&gt;I don&amp;#39;t think the &amp;quot;refresh never&amp;quot; option is available anymore. In our own application with untrusted devices we see the cache being used. In the nRF connect app we see that there is a 1.5 second discovery process run any time we connect to an untrusted device. The latter is according to the Bluetooth specification, but not according to the default behavior represented in &lt;a href="https://code.google.com/p/android/issues/detail?id=81130"&gt;code.google.com/.../detail&lt;/a&gt;. Only for example Samsung devices invalidate the cache for untrusted devices. (Personally wish: it would have been great from the Specification designers to have left the decision of using cache yes/no to the application developer.)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRFToobox on Android not recognizing changes in application type running on Nordic pcb</title><link>https://devzone.nordicsemi.com/thread/16945?ContentTypeID=1</link><pubDate>Tue, 16 Dec 2014 15:27:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21e46198-b71a-4128-a7dd-ac552ef03836</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Np :) For example in ble_app_hrs in SDK 6.1.0 it is in main.c on line 54. You can also search for it, CTRL+F-&amp;gt;Find in Files tab.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRFToobox on Android not recognizing changes in application type running on Nordic pcb</title><link>https://devzone.nordicsemi.com/thread/16944?ContentTypeID=1</link><pubDate>Tue, 16 Dec 2014 15:15:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c860491-5f19-4154-bfe5-9552142ba454</guid><dc:creator>Paul Russell</dc:creator><description>&lt;p&gt;I&amp;#39;m sorry but still new to this...&lt;/p&gt;
&lt;p&gt;Exactly where in an example would I add/change:  IS_SRVC_CHANGED_CHARACT_PRESENT 1?&lt;/p&gt;
&lt;p&gt;I searched through SDK6.1 examples but couldn&amp;#39;t ind this.&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t download SDK7 examples as my Nordic demos are older nRF51822-DK and nRF51822-EK whick only go to SDK6.1 on downloads.&lt;/p&gt;
&lt;p&gt;Most of my nRF work is in mbed, that is where I really would like to try this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRFToobox on Android not recognizing changes in application type running on Nordic pcb</title><link>https://devzone.nordicsemi.com/thread/16943?ContentTypeID=1</link><pubDate>Tue, 16 Dec 2014 14:19:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b8d7a76-d6e3-413a-a5f7-fd736e4871cb</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;I have been able to reproduce this on Android 4.4.4, and did some investigating.&lt;/p&gt;
&lt;p&gt;This is actually a Android bug, not a nRF Toolbox/nRF Master Control Panel bug.&lt;/p&gt;
&lt;p&gt;On Android 4.3 the cache was cleared if you restarted Bluetooth, but this does not happen in 4.4 (and 5). I think this modification was on purpose.&lt;/p&gt;
&lt;p&gt;Attribute catching is explained in Vol 3, Part G, Section 2.5.2 in the &lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Core_5F00_v4.2.pdf"&gt;Bluetooth Core Specification 4.2&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;If GATT based services on the server
cannot be changed during the usable
lifetime of the device, the Service
Changed characteristic shall not exist
on the server and the client does not
need to ever perform service discovery
after the initial service discovery
for that server.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This means that if the Service Changed characteristic doesn&amp;#39;t exist, Android can cache the attributes.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;For clients that have a trusted
relationship (i.e. bond) with the
server, the attribute cache is valid
across connections. For clients with a
trusted relationship and not in a
connection when a service change
occurs, the server shall send an
indication when the client reconnects
to the server.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This means that if the devices are bonded Android can cache the attributes.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;For clients that do not have a trusted
relationship with the server, the
attribute cache is valid only during
the connection. Clients without a
trusted relationship shall receive an
indication when the service change
occurs only during the current
connection.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This means that if the devices are not bonded, Android can cache the attributes, but they must be cleared between every connection. Android do not do this.&lt;/p&gt;
&lt;p&gt;When you disconnect from Master Control Panel the cache is manually cleared. But this is not done in nRF Toolbox.&lt;/p&gt;
&lt;p&gt;This should only be a problem in development because the DFU procedure also manually clears the cache.&lt;/p&gt;
&lt;p&gt;The workaround is to do a disconnect in Master Control Panel if you change apps.&lt;/p&gt;
&lt;p&gt;The service changed characteristic is included in the SDK examples by setting &lt;code&gt;IS_SRVC_CHANGED_CHARACT_PRESENT&lt;/code&gt; to 1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRFToobox on Android not recognizing changes in application type running on Nordic pcb</title><link>https://devzone.nordicsemi.com/thread/16935?ContentTypeID=1</link><pubDate>Tue, 16 Dec 2014 13:56:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b38269c7-a61d-4d96-96e8-6d1efea03f8f</guid><dc:creator>Aleksander Nowakowski</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There are 4 ways to clear the attribute cache on Android:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Using Service Changed characteristic - the proper solution:&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;a) when not bonded - android should never cache services if such characteristic is present in Generic Attribute service. However it always does - this is the Android bug, reported here: &lt;a href="https://code.google.com/p/android/issues/detail?id=81130"&gt;code.google.com/.../detail&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;b) when bonded - a device may enable CCCD indications on Service Changed char. Whenever Android receives this indication it will perform service rediscovery automatically.
When writing Android code make sure that you give ~2 sec after you get onConnectionStateChange(Connected) event before calling gatt.discoverServices() when you expect that the indication may be received. If you call it immediately, inside the onConnStateCh callback, you&amp;#39;ll get old services as this callback is called immediately when you connect but before the bond has been re-established and the indication was sent.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;When you don&amp;#39;t use bonding or you don&amp;#39;t want to use Service Changed indications, or when you are flashing your board with different firmwares you may find useful this:&lt;/p&gt;
&lt;ol start="2"&gt;
&lt;li&gt;
&lt;p&gt;Using Android hack - there is a hidden method refresh() on the Android API. It works since Android 4.3 but it may be removed in any new release. I&amp;#39;m calling it when you disconnect from the DFU in nRF Toolbox and whenever you disconnect from the device in MCP. In the upcomming version MCP 2.1 (release tomorrow(?)) there will be an option to change in MCP settings (connectivity): refresh always (after disconnection), refresh only when not bonded (also only after diconnnecting), refresh never (actually it will refresh when an error occur)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use different device address when services are different. When you design a firmware that has different modes with different services consider using different device address in every of them. In that case the cache will not be a problem.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;On older versions of Android (f.e. 4.3) restarting Bluetooth adapter was also clearing the cache. As we can observe now this no longer works which is OK (cache shouldn&amp;#39;t be cleared unless services are changed). This no longer works.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;hr /&gt;
&lt;p&gt;So.. if you want to use different firmware on the same device use the trick with the nRF MCP. As I&amp;#39;ve written before it refreshes the cache every time it disconnects from the device. If you check the log on DEBUG level you will see the gatt.refresh() method being called.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRFToobox on Android not recognizing changes in application type running on Nordic pcb</title><link>https://devzone.nordicsemi.com/thread/16934?ContentTypeID=1</link><pubDate>Wed, 10 Dec 2014 15:12:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e48b8de5-13a0-4618-a6ae-7246d4cd6dab</guid><dc:creator>Paul Russell</dc:creator><description>&lt;p&gt;Possibly:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If not properly disconnect then App data in Android may be confused.&lt;/li&gt;
&lt;li&gt;This may be a &lt;em&gt;bug&lt;/em&gt; in latest nRF-MCP/nRF-ToolBox for Android (Released ~20141209?)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Try:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open nRF-MCP in Android, select device, connect, disconnect (Ensure disconnect happens)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;UART device doesn&amp;#39;t seem to offer disconnect (nRF51 sample code may need tweak)&lt;/li&gt;
&lt;li&gt;May need to load a 3rd sample, disconnect from that, then try new sample.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Still testing.
This method of using nRF-MCP to disconnect between sample type changes (HTM, HTM, UART) does appear to be working, consider it a &amp;quot;work around&amp;quot; for now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>