Class DownloadServiceBinder

All Implemented Interfaces:

public class DownloadServiceBinder extends Binder
The binder providing access to DownloadService.

Bind to DownloadService as follows:

 DownloadServiceBinder downloadServiceBinder;
 ServiceConnection downloadServiceConnection = new ServiceConnection() {
        public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
                downloadServiceBinder = (DownloadServiceBinder) iBinder;
        public void onServiceDisconnected(ComponentName componentName) {
                downloadServiceBinder = null;

 String downloadId = "ID";
 File moviesFolder = getExternalFilesDir(Environment.DIRECTORY_MOVIES);
 File target = new File(moviesFolder, "Downloads/" + downloadId);

 Bundle bundle = new Bundle();
 bundle.putString(SdkConsts.INTENT_URL, "MANIFEST_URL");
 bundle.putString(SdkConsts.INTENT_DOWNLOAD_ID, downloadId);
 bundle.putString(SdkConsts.INTENT_DOWNLOAD_FOLDER, target.getAbsolutePath());

 downloadServiceBinder.prepareDownload(context, bundle, new Downloader.ModelReadyCallback() {
        public void onError(@NonNull Exception e) {
                Log.e(TAG, "Error while preparing download: " + e.getMessage(), e);
        public void onModelAvailable(@NonNull Download download) {
                // initiate selection here of video quality, audio and subtitle tracks
                // either automatically or manually
  • Field Details

    • allowNonScopedStorageDownload

      public static boolean allowNonScopedStorageDownload
      This flag indicates whether to allow downloads to be downloaded into system paths which are not part of the scoped storage. This flag is false by default.
    • autoStopService

      public static boolean autoStopService
      This flag indicates whether to stop the Service once there are no pending downloads. You may want to disable this flag in case your workflow contemplates starting or resuming Downloads whenever the app is in background, or whenever the App is in a state which is not allowed by the system to promote the service to foreground. If disabled, you must take responsibility for stopping the service once it's not needed by your Application anymore. The recommended approach is to listen for the MessageHandler.ACTION_DOWNLOAD_NO_PENDING broadcast event. See stopService(). true by default.
  • Method Details