<?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>OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68592/ota-dfu-in-background-with-no-notification</link><description>Hi, I have implemented OTA DFU on Android with your official DFU library. We want the DFU to happen in background at a certain trigger (car driving, triggered from device = user will stay near device) and without bothering the user that this is happening</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 25 Nov 2020 14:17:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68592/ota-dfu-in-background-with-no-notification" /><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281846?ContentTypeID=1</link><pubDate>Wed, 25 Nov 2020 14:17:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fcd7115b-9112-4abc-8422-ffdef31362a9</guid><dc:creator>Roshan Rajaratnam</dc:creator><description>&lt;p&gt;That&amp;#39;s great sorry it took a bit longer than I expected but I guess we got to it in the end. I have also just released a version 1.11.1&amp;nbsp; to bintray. Give it a shot it should work out of the box as I have set the ScanFilter based on the address. Let me know how that goes so you can stick to the original dependency.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281828?ContentTypeID=1</link><pubDate>Wed, 25 Nov 2020 13:50:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:044c06ea-2511-4df4-9221-d1ab2f1dbd24</guid><dc:creator>SorenKonekt</dc:creator><description>&lt;p&gt;Yes, there we go. This seems to have solved the problem. Thank you Roshan!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281734?ContentTypeID=1</link><pubDate>Wed, 25 Nov 2020 09:20:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f03e650d-e217-4826-83bc-a80908ea0798</guid><dc:creator>Roshan Rajaratnam</dc:creator><description>&lt;p&gt;Ok I see your point&amp;nbsp;now, let me get back to you.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;EDIT: So i did some digging. you are 100% correct about the scan filter. There seems to be an issue on our end where we don&amp;#39;t include a scan filter (this is to ensure backward compatibility with some older devices) while scanning after the device jumps in to the bootloader mode but I managed to get it working on the background. For now I would suggest you to clone the Android-DFU-Library project and include it manually in your project and add&amp;nbsp;your device name as the scan filter and pass it in to the startScan method &lt;a href="https://github.com/NordicSemiconductor/Android-DFU-Library/blob/8e6dd807f263096801267fbad3cf5f3823b09790/dfu/src/main/java/no/nordicsemi/android/dfu/internal/scanner/BootloaderScannerLollipop.java#L92"&gt;here&lt;/a&gt;. For this to work I had to include&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;quot;android.permission.ACCESS_BACKGROUND_LOCATION&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;in the manifest file and ensure its granted from the app settings as &amp;quot;Allow all the time&amp;quot;. The way I tested this was by adding a 10 second delayed runnable and locking the screen off. Here&amp;#39;s the exact snippet.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;new Handler().postDelayed(() -&amp;gt; starter.start(context, DfuService.class), 10000);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Give it a go and let me know how it works out for you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281731?ContentTypeID=1</link><pubDate>Wed, 25 Nov 2020 09:05:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20ea9677-9c59-4ac3-8ea5-a47d9726e66c</guid><dc:creator>SorenKonekt</dc:creator><description>&lt;p&gt;Thanks for your support Roshan, it&amp;#39;s very kind of you.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Again, I don&amp;#39;t understand however, how this should affect our app since we do &lt;strong&gt;not&lt;/strong&gt;&amp;nbsp;use unfiltered scans. We are filtering &lt;span style="text-decoration:underline;"&gt;all scans with the name of our device&lt;/span&gt;, always. So this doesn&amp;#39;t really apply to our case. It should still receive scan results in screen-off mode.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regarding the permission,&amp;nbsp;this has been granted by the user during onboarding (and also on the phones that I&amp;#39;m testing on here at the office) but I don&amp;#39;t think this is relevant since we are running a foreground service for the app (with a notification). All scanning is handled in this service.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281669?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 19:19:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1629a83-f349-47ff-84ad-3d25b2179331</guid><dc:creator>Roshan Rajaratnam</dc:creator><description>&lt;p&gt;Seems like&amp;nbsp;an android limitation from what I read from the documentation, if the screen is turned off your scanning will not return scan results irrespective of the service type.&lt;/p&gt;
&lt;p&gt;Once&amp;nbsp;the connection is established it doesn&amp;#39;t matter if the screen is or not and as long as the service is on the foreground android will not try to kill it.&lt;/p&gt;
&lt;p&gt;Yours is a very specific case which needs some research. There is one more issue you might face in your approach of background&amp;nbsp;DFU upload is that, user needs to grant location permission for scanning, with the new permission scheme, a user might select grant location permission &amp;quot;while app in use&amp;quot; option. I&amp;#39;m not entirely sure how it will behave in this scenario and you will definitely need background location permission. Oh and btw have you granted background location permission ? Could you just try with that and see if that gives you any scan result? After all that could be a reason. I assumed if this is in place already. You may refer &lt;a href="https://developer.android.com/training/location/permissions#request-background-location"&gt;this&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281623?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 14:55:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:adf10afc-e76d-48de-b4eb-67027e12e941</guid><dc:creator>SorenKonekt</dc:creator><description>&lt;p&gt;Ok.. can I ask also, how does a Service and the state of the display affect each other? Shouldn&amp;#39;t a foreground service care less about the state of the screen?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;and lastly, are you saying that we simply need to make sure that OTA DFU happens in an approach where the user keeps the screen on ? It is simply not possible with the screen turned off, is what I&amp;#39;m hearing you say?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281615?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 14:43:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58562612-9964-426e-a901-411b905a260e</guid><dc:creator>Roshan Rajaratnam</dc:creator><description>&lt;p&gt;No question is stupid&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;. The reason we don&amp;#39;t use autoconnect is that when the device goes into bootloader mode the address of the device changes, hence the scan and connect. Usually address is incremented by 1 when it goes in to bootloader mode. In addition the address of a&amp;nbsp;device can change during every power recycle causing the address to remain unknown.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281613?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 14:35:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06c2894b-0b63-4a7b-b8d7-6cd95ae79783</guid><dc:creator>SorenKonekt</dc:creator><description>&lt;p&gt;I see... our app normally&amp;nbsp;reconnects to a user&amp;#39;s device when he gets near it (while the phone is in the pocket and screen off) but I guess that must be the autoconnect that handles that, and not any scan results.. couldn&amp;#39;t the DFU process be able to reconnect back to the device during DFU instead of using a Scan ? I mean, it&amp;#39;s a known device which it had a connection to just seconds ago.. might be stupid questions here, I don&amp;#39;t know&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281610?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 14:29:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:587e9f74-e156-462f-ab7d-fc4cc2bf3b5e</guid><dc:creator>Roshan Rajaratnam</dc:creator><description>&lt;p&gt;That&amp;#39;s correct you may scan,&amp;nbsp;but it states that you don&amp;#39;t get a scan result for your filtered scan and your receive them when the screen turns on. The library will scan for the device and then connect to it upon receiving the scan result. However you may try implementing a wakelock to keep the screen on and it MIGHT work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281604?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 14:24:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79b17671-ede0-4f04-a47a-2f9a2305bd94</guid><dc:creator>SorenKonekt</dc:creator><description>&lt;p&gt;Hmm.. I see.. but according to that commit it seems to only affect unfiltered scans. I have 1 filter (based on device name) in my scans. Shouldn&amp;#39;t it work fine then?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281600?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 14:16:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2e2f20f-888b-497b-b699-233ab5aaf344</guid><dc:creator>Roshan Rajaratnam</dc:creator><description>&lt;p&gt;OK now I understand the issue you are facing. This is something Android changed sometime ago where you will not receive any scan results while the device screen is turned off. This might be the issue you are facing. Checkout this commit from the Android &lt;a href="https://android.googlesource.com/platform/packages/apps/Bluetooth/+/319aeae6f4ebd13678b4f77375d1804978c4a1e1"&gt;source&lt;/a&gt;. I would recommend doing it while the app is in the foreground if there is nothing stopping you from doing it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281595?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 14:04:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a905e90b-0f7c-4d46-ab26-493852566528</guid><dc:creator>SorenKonekt</dc:creator><description>&lt;p&gt;no this is with screen turned off. is it really not possible to automate the DFU while the user has his phone in the pocket ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281594?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 14:01:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f71ca9f4-4393-4dff-b485-28c6d56bd5c6</guid><dc:creator>Roshan Rajaratnam</dc:creator><description>&lt;p&gt;Is your app in the foreground at this point of time?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281589?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 13:57:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5072f442-c05f-484f-be89-532b3b3115e1</guid><dc:creator>SorenKonekt</dc:creator><description>&lt;p&gt;So, fixed the bad notification channel by calling createDfuNotification, but now I&amp;#39;m back to square one:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt; E/DfuBaseService: Connection state change error: 133 newState: 0
 E/DfuBaseService: Device not reachable. Check if the device with address D6:DB:22:57:34:07 is in range, is advertising and is connectable&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281588?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 13:56:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26acace2-9d30-47b7-a7db-9d22c7af8625</guid><dc:creator>Roshan Rajaratnam</dc:creator><description>&lt;p&gt;Hi it&amp;#39;s all done for you and it&amp;#39;s just a matter of calling that function. You may notice that it&amp;#39;s a static&amp;nbsp;&lt;a href="https://github.com/NordicSemiconductor/Android-DFU-Library/blob/release/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java#L886"&gt;function&lt;/a&gt;&amp;nbsp;and you should be able to call it from anywhere and call it before you start the service. There is some more information about it at the end of the &lt;a href="https://github.com/NordicSemiconductor/Android-DFU-Library/blob/release/documentation/README.md"&gt;documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Hope this helps&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281573?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 13:23:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d82afe42-1e44-4c0b-8a2b-3c5ba9e7d0d2</guid><dc:creator>SorenKonekt</dc:creator><description>&lt;p&gt;also, DfuServiceInitiator doesn&amp;#39;t appear to know the reference to any method called&amp;nbsp;&lt;span&gt;createDfuNotificationChannel ?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281571?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 13:21:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d76ad73-9927-4cbc-90d9-3e75800f8bf0</guid><dc:creator>SorenKonekt</dc:creator><description>&lt;p&gt;Yes, it has to do with the notification channel. But I thought the DFU library was handling that already? inside DfuBaseService class, there is this code&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;private void startForeground() {
		final NotificationCompat.Builder builder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_DFU)
				.setSmallIcon(android.R.drawable.stat_sys_upload)
				.setContentTitle(getString(R.string.dfu_status_foreground_title)).setContentText(getString(R.string.dfu_status_foreground_content))
				.setColor(Color.GRAY)
				.setPriority(NotificationCompat.PRIORITY_LOW)
				.setOngoing(true);

		// Update the notification
		final Class&amp;lt;? extends Activity&amp;gt; clazz = getNotificationTarget();
		if (clazz != null) {
			final Intent targetIntent = new Intent(this, clazz);
			targetIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			targetIntent.putExtra(EXTRA_DEVICE_ADDRESS, mDeviceAddress);
			targetIntent.putExtra(EXTRA_DEVICE_NAME, mDeviceName);
			final PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, targetIntent, PendingIntent.FLAG_UPDATE_CURRENT);
			builder.setContentIntent(pendingIntent);
		} else {
			logw(&amp;quot;getNotificationTarget() should not return null if the service is to be started as a foreground service&amp;quot;);
			// otherwise the notification will not be clickable.
		}

		// Any additional configuration?
		updateForegroundNotification(builder);

		startForeground(NOTIFICATION_ID, builder.build());
	}&lt;/pre&gt;so the notification id and channel is already defined and should be started from the library itself, no?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281562?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 13:04:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b1b4de2a-4ec4-4a84-b38e-60750709db99</guid><dc:creator>Roshan Rajaratnam</dc:creator><description>&lt;p&gt;This is related to displaying a notification,&amp;nbsp;Did you create a notification channel?&lt;/p&gt;
&lt;p&gt;DfuServiceInitiator.createDfuNotificationChannel(context);&lt;/p&gt;
&lt;p&gt;Please refer to the nRF Toolbox example where you&amp;#39;ll find a complete example of the using the DFU library..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281534?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 12:10:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd81c390-4699-4c2f-ab36-007fe757d38c</guid><dc:creator>SorenKonekt</dc:creator><description>&lt;p&gt;I have now set the &amp;quot;setForeground(true)&amp;quot; instead of false, and now it crashes the whole app instead:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;2020-11-24 13:05:47.869 10096-10096/&amp;quot;****** E/&amp;quot;******: [qarth_debug:]  get PatchStore::createDisableExceptionQarthFile method fail.
    
    --------- beginning of crash
2020-11-24 13:05:47.875 10096-10096/&amp;quot;****** E/AndroidRuntime: FATAL EXCEPTION: main
    Process: &amp;quot;******, PID: 10096
    android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=dfu pri=-1 contentView=null vibrate=null sound=null defaults=0x0 flags=0x42 color=0xff888888 vis=PRIVATE)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2126)
        at android.os.Handler.dispatchMessage(Handler.java:112)
        at android.os.Looper.loop(Looper.java:216)
        at android.app.ActivityThread.main(ActivityThread.java:7625)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I have the service permission in the manifest, and also declared the service&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;service
            android:name=&amp;quot;******.device.DfuService&amp;quot;
            android:enabled=&amp;quot;true&amp;quot;
            android:exported=&amp;quot;false&amp;quot;
            android:foregroundServiceType=&amp;quot;connectedDevice&amp;quot;
        /&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281505?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 10:57:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52fde25c-0d1e-4d13-ba52-648c2ce3c44b</guid><dc:creator>Roshan Rajaratnam</dc:creator><description>&lt;p&gt;This is the default behavior from Android 8&amp;nbsp; onwards as stated in the documentation. Android has become more strict on background services which is understandable. You can have multiple foreground services so I recommend start the dfu in its own foreground service which it should do it by self.&amp;nbsp;Make sure to add the foreground service permission in the manifest file and follow the usage instructions on &lt;a href="https://github.com/NordicSemiconductor/Android-DFU-Library/tree/release/documentation"&gt;Github&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281458?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 08:31:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f884823-e27d-40bb-97d4-07119f4f3939</guid><dc:creator>SorenKonekt</dc:creator><description>&lt;p&gt;Hi Roshan,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have seen this behavior on Android 8 and 9. How can I circumvent this? Should I put the actual DFU code in a foreground service? Is that recommended? I mean I already have a foreground service for my app, but I didn&amp;#39;t put the DFU code there&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;EDIT: as far as I can see, it should be automatically started as a foregroundService by your library if Android OS is 8 or newer. Here from DfuServiceInitiator on your github:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if (Build.VERSION.SDK_INT &amp;gt;= Build.VERSION_CODES.O &amp;amp;&amp;amp; startAsForegroundService) {
			// On Android Oreo and above the service must be started as a foreground service to make it accessible from
			// a killed application.
			context.startForegroundService(intent);
		} else {
			context.startService(intent);
		}
		return new DfuServiceController(context);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281246?ContentTypeID=1</link><pubDate>Mon, 23 Nov 2020 08:37:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd98ba65-4899-4b5d-81a2-3ccb11447629</guid><dc:creator>Roshan Rajaratnam</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/sorenkonekt"&gt;SorenKonekt&lt;/a&gt;&amp;nbsp;what version of Android are you experiencing this? This may also happen due to the background execution limits as Android has become much more strict on background services and especially when your app is not in foreground. You may refer to the documentation&amp;nbsp;on background services&amp;nbsp;&lt;a href="https://developer.android.com/guide/components/services"&gt;here&lt;/a&gt;. As a mobile app developer myself and a IMHO it&amp;#39;s always good for the user to know what&amp;#39;s going on even though the user may not actively look at the screen, but after all it&amp;#39;s your call &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281122?ContentTypeID=1</link><pubDate>Fri, 20 Nov 2020 13:37:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5802dc7-6c85-449d-9071-492640aeec7b</guid><dc:creator>SorenKonekt</dc:creator><description>&lt;p&gt;this seems to also be able to happen when the app is in foreground and active.. it just seems very unstable ...&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281092?ContentTypeID=1</link><pubDate>Fri, 20 Nov 2020 12:18:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ed337bb-8396-4d35-9f93-9268d685a6b9</guid><dc:creator>SorenKonekt</dc:creator><description>&lt;p&gt;OK, so this is happening on a Huawei FIX-LX1 model but not on a Cat S41.. exact same application and test procedure (in background OTA DFU)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;EDIT: Nope it&amp;#39;s also happening on the Cat s41. It is apparently not 100% consistent in reproduction&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: OTA DFU in background with no notification?</title><link>https://devzone.nordicsemi.com/thread/281069?ContentTypeID=1</link><pubDate>Fri, 20 Nov 2020 10:23:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2a6ec1a-6c9b-40db-9af7-cf3d94fbb61a</guid><dc:creator>SorenKonekt</dc:creator><description>&lt;p&gt;Perhaps it is related to the DfuService not having a foregroundServiceType specified in the manifest for it?&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;service
    android:name=&amp;quot;co.wusaa.parking.comm.device.DfuService&amp;quot;
    android:enabled=&amp;quot;true&amp;quot;
    android:exported=&amp;quot;false&amp;quot;
/&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;EDIT: adding &amp;quot;connectedDevice&amp;quot; as foregroundServiceType did not change anything.. same errors&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>