when restarted with EXTRA_FOREGROUND_SERVICE flag set to true, the service will be started using startForegroundService(Intent) instead of startService(Intent)
when startForeground(int, Notification) crashes due to security exception (app is in background and the service cannot be started in foreground) the error is logged and ignored. As DFU is not very long task, the app update should succeed nevertheless.
This PR fixes the following issues:
EXTRA_FOREGROUND_SERVICE
flag set to true, the service will be started usingstartForegroundService(Intent)
instead ofstartService(Intent)
startForeground(int, Notification)
crashes due to security exception (app is in background and the service cannot be started in foreground) the error is logged and ignored. As DFU is not very long task, the app update should succeed nevertheless.