private void InitDownloadManager()
        {
            lock (_lock)
            {
                if (downloadManager == null)
                {
                    DownloaderConstructorHelper downloaderConstructorHelper = new DownloaderConstructorHelper(
                        GetDownloadCache(),
                        BuildHttpDataSourceFactory(/* listener= */ null));

                    downloadManager =
                        new Offline.DownloadManager(
                            downloaderConstructorHelper,
                            MAX_SIMULTANEOUS_DOWNLOADS,
                            Offline.DownloadManager.DefaultMinRetryCount,
                            new File(GetDownloadDirectory(), DOWNLOAD_ACTION_FILE),
                            DOWNLOAD_DESERIALIZERS);

                    downloadTracker =
                        new DownloadTracker(
                            /* context= */ this,
                            BuildDataSourceFactory(/* listener= */ null),
                            new File(GetDownloadDirectory(), DOWNLOAD_TRACKER_ACTION_FILE),
                            DOWNLOAD_DESERIALIZERS);
                    downloadManager.AddListener(downloadTracker);
                }
            }
        }
        public void OnTaskStateChanged(Offline.DownloadManager downloadManager, TaskState taskState)
        {
            DownloadAction action = taskState.Action;

            android.Net.Uri uri = action.Uri;
            if ((action.IsRemoveAction && taskState.State == TaskState.StateCompleted) ||
                (!action.IsRemoveAction && taskState.State == TaskState.StateFailed))
            {
                // A download has been removed, or has failed. Stop tracking it.
                if (trackedDownloadStates.Remove(uri.ToString()) != false)
                {
                    HandleTrackedDownloadStatesChanged();
                }
            }
        }
 public void OnIdle(Offline.DownloadManager downloadManager)
 {
     // Do nothing.
 }
        // DownloadManager.Listener

        public void OnInitialized(Offline.DownloadManager downloadManager)
        {
            // Do nothing.
        }