Exoplayer, When i disconnect wifi while downloading a video,it crashes app and show below error, What can i do so the app will not crash and give a Toast instead that No Internet. Here is the error
Process: com.a.acs2, PID: 22492
java.lang.IllegalArgumentException: No such service ComponentInfo{com.a.acs2/androidx.media3.exoplayer.scheduler.PlatformScheduler$PlatformSchedulerService}
at android.os.Parcel.readException(Parcel.java:1560)
at android.os.Parcel.readException(Parcel.java:1509)
at android.app.job.IJobScheduler$Stub$Proxy.schedule(IJobScheduler.java:122)
at android.app.JobSchedulerImpl.schedule(JobSchedulerImpl.java:42)
at androidx.media3.exoplayer.scheduler.PlatformScheduler.schedule(PlatformScheduler.java:86)
at androidx.media3.exoplayer.offline.DownloadService$DownloadManagerHelper.updateScheduler(DownloadService.java:1020)
at androidx.media3.exoplayer.offline.DownloadService.onIdle(DownloadService.java:838)
at androidx.media3.exoplayer.offline.DownloadService.access$700(DownloadService.java:56)
at androidx.media3.exoplayer.offline.DownloadService$DownloadManagerHelper.onIdle(DownloadService.java:1065)
at androidx.media3.exoplayer.offline.DownloadManager.onMessageProcessed(DownloadManager.java:650)
at androidx.media3.exoplayer.offline.DownloadManager.handleMainMessage(DownloadManager.java:607)
at androidx.media3.exoplayer.offline.DownloadManager.$r8$lambda$Ljilo1rwNXzdYIqsr2zvGuwCKeY(DownloadManager.java)
at androidx.media3.exoplayer.offline.DownloadManager$$ExternalSyntheticLambda0.handleMessage(D8$$SyntheticClass:0)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:5958)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1113)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:879)
i tried but find nothing on exoplayer doc
Looks like when network connectivity is lost while downloading, exoplayer will try to schedule the download, probably to resume the download when connectivity is back. And it's missing PlatformSchedulerService while trying to invoke it. Add this to your manifest and try again
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<service android:name="androidx.media3.exoplayer.scheduler.PlatformScheduler$PlatformSchedulerService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="true"/>