Android-DFU-Library icon indicating copy to clipboard operation
Android-DFU-Library copied to clipboard

IntentService is deprecated

Open AimFirst opened this issue 5 years ago • 3 comments

DfuBaseService extends IntentService. However, IntentService is deprecated. There's a few known issues with them not working reliably (for example on a galaxy J7). Is there any plan to update the base service to use something newer (JobIntentService perhaps)?

AimFirst avatar Feb 05 '20 18:02 AimFirst

Hello, IntentService is not deprecated. The JobIntentService has slightly different purpose, it doesn't have to be started immediately, and this is the behavior we want in DFU library. IntentService is just a service, that starts a thread to perform a task and stops itself when the task is complete. There are of course some restrictions related to background execution limits on Android 8+, but that's why the DfuServiceInitiator has setForeground(boolean) method, which defaults to true. This will show a notification to the user, but that is intended. The notification can be customized by extending updateForegroundNotification(NotificationCompat.Builder builder) method in the Dfu Service implementation.

Besides, what issues are you talking about?

philips77 avatar Feb 12 '20 08:02 philips77

Official Android documentation tells android IntentService is deprecated on API Level 26+, refer to: https://developer.android.com/reference/android/app/IntentService

AndresQuiVal avatar May 27 '20 15:05 AndresQuiVal

It's deprecated in Android R, that is API 30. The lib starts the service in foreground to avoid background execution limits problems. Usually, when user clicks "update", they want the job done now, not in some future... I'll think about it. In mcumgr lib, for updates of devices running firmware based on nRF Connect SDK, we provide lower level implementation, where it is the user that needs to implement the service or a job.

philips77 avatar May 27 '20 21:05 philips77