What we have tried to achive is to run a download manager void delete(DownloadBatchId downloadBatchId) from androidx.work.Worker.
It seems to have been working sucessfully but when app goes to background (or is killed) then on some devices there are frequent occurances of:
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.novoda.downloadmanager.eb.a(com.novoda.downloadmanager.u)' on a null object reference
at com.novoda.downloadmanager.DownloadManagerBuilder$1.onServiceConnected(DownloadManagerBuilder.java:252)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1223)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1240)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
It seems that the application is waken up properly and it is crashing on initializing the DownloadManager
`class AutoDeleteWorker @AssistedInject constructor(
// assisted annotated names MUST exactly match those in the ChildWorkerFactory!!!!!
@Assisted context: Context,
@Assisted params: WorkerParameters,
private val downloadRepository: DownloadRepository,
private val downloadInteractor: DownloadInteractor
) : Worker(context, params) {
override fun doWork(): Result {
//trigger downloadInteractor.delete(downloadId)
return Result.success()
}
@AssistedInject.Factory
interface Factory : ChildWorkerFactory
}`
Is there already a working solution to trigger the downloadManager from worker?
What we have tried to achive is to run a download manager void delete(DownloadBatchId downloadBatchId) from androidx.work.Worker. It seems to have been working sucessfully but when app goes to background (or is killed) then on some devices there are frequent occurances of:
It seems that the application is waken up properly and it is crashing on initializing the DownloadManager
`class AutoDeleteWorker @AssistedInject constructor( // assisted annotated names MUST exactly match those in the ChildWorkerFactory!!!!! @Assisted context: Context, @Assisted params: WorkerParameters, private val downloadRepository: DownloadRepository, private val downloadInteractor: DownloadInteractor ) : Worker(context, params) {
}`
Is there already a working solution to trigger the downloadManager from worker?