<?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 BLE Library</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/39930/android-ble-library</link><description>Hi, our current Android application is based on nrf uart app example and we want to restart an implementation based on template example on top of BleManager library. Could you tell us if it respects new behaviors changes on background and service of android</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 29 Oct 2018 14:56:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/39930/android-ble-library" /><item><title>RE: Android BLE Library</title><link>https://devzone.nordicsemi.com/thread/154911?ContentTypeID=1</link><pubDate>Mon, 29 Oct 2018 14:56:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e560090-5a55-4bd4-a54f-6fb9627cc9ed</guid><dc:creator>franck</dc:creator><description>&lt;p&gt;Yes that is what we need, a service that is foreground and keep on running when activity become not visible and is stopped or destroyed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android BLE Library</title><link>https://devzone.nordicsemi.com/thread/154908?ContentTypeID=1</link><pubDate>Mon, 29 Oct 2018 14:33:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c659ce0-2c0f-4c27-8e4c-b1355d5221ba</guid><dc:creator>Aleksander Nowakowski</dc:creator><description>&lt;p&gt;Yes, that would be my advise. To keep the service running you just need to start it as a foreground service. In order to do that, call startForeground(..). Before that you also need to create the notification channel.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Check out how do we do it in DFU: &lt;a href="https://github.com/NordicSemiconductor/Android-DFU-Library/blob/release/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java#L723"&gt;https://github.com/NordicSemiconductor/Android-DFU-Library/blob/release/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java#L723&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;and &lt;a href="https://github.com/NordicSemiconductor/Android-DFU-Library/blob/release/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java#L765"&gt;https://github.com/NordicSemiconductor/Android-DFU-Library/blob/release/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java#L765&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android BLE Library</title><link>https://devzone.nordicsemi.com/thread/154906?ContentTypeID=1</link><pubDate>Mon, 29 Oct 2018 14:25:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0938b9e-a1be-417e-bb6c-28c3510699e0</guid><dc:creator>franck</dc:creator><description>&lt;p&gt;Hello Aleksander,&lt;/p&gt;
&lt;p&gt;Thank you for your answer, my question regarding background services was more related on BleProfileService in nrf toolbox which is not indead part of&amp;nbsp;&lt;span&gt;BLE Library but which is derived in nrf toolbox template&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Our&amp;nbsp;need is that our application can also work in in background so I guess that nrF Blinky is not the best example to start with&lt;/p&gt;
&lt;p&gt;We already started to customize template exemple in NRF toolbox&amp;nbsp;2.6.0 (latest official release) which is based on Ble library 1.2.0.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So you advise us to restart using NRF toolbox alpha 3.0.0-alpha1 version that is working on top of&amp;nbsp;&lt;span&gt;BLE Library 2 ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Thanks,&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Franck&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android BLE Library</title><link>https://devzone.nordicsemi.com/thread/154881?ContentTypeID=1</link><pubDate>Mon, 29 Oct 2018 13:27:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:570aa727-b114-4799-b300-1dbcf37d1b2f</guid><dc:creator>Aleksander Nowakowski</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/franck"&gt;franck&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;First of all, I highly recommend switching to BLE Library. In fact, the version 2 of it, which is now in beta6 phase, will very soon be the only maintained version, so please use this one. Despite the beta in the name, it&amp;#39;s well tested and has more features then 1.2.&lt;/p&gt;
&lt;p&gt;nRF Toolbox uses this beta version on *develop* branch.&lt;/p&gt;
&lt;p&gt;However, the BLE Library only handles the connection. It may be used in a service, in view model (or repository inside), in an activity for some simple use cases, etc. On its own it doesn&amp;#39;t care about how it&amp;#39;s being used, so also does nothing regarding the changes in Android Oreo.&lt;/p&gt;
&lt;p&gt;On the other hand, the nRF Toolbox, which is using this library, should care about all those issue, and should start its services as foreground service. It has been pointed today: &lt;a href="https://github.com/NordicSemiconductor/Android-nRF-Toolbox/issues/57"&gt;https://github.com/NordicSemiconductor/Android-nRF-Toolbox/issues/57&lt;/a&gt; that it isn&amp;#39;t doing that, and the running service will be likely killed 5 minutes after the app went to background. I&amp;#39;ll fix it before the nRF Toolbox *develop* is merged to *master*.&lt;/p&gt;
&lt;p&gt;You may also check [nRF BLinky](&lt;a href="https://github.com/NordicSemiconductor/Android-nRF-Blinky"&gt;https://github.com/NordicSemiconductor/Android-nRF-Blinky),&lt;/a&gt; which is using Architecture Components and is handling the connection from the View Model. But in that case we don&amp;#39;t support background connection at all, that&amp;#39;s why it&amp;#39;s possible.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Hope that answers your questions,&lt;/p&gt;
&lt;p&gt;Aleksander&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>