public static void InstallFinishedMB()
        {
            Android.App.DownloadManager.Query query = new Android.App.DownloadManager.Query();

            query.SetFilterByStatus(DownloadStatus.Successful);

            Android.App.DownloadManager downloadManager = (Android.App.DownloadManager)Context.GetSystemService("download");

            ICursor cursor = downloadManager.InvokeQuery(query);

            while (cursor.MoveToNext())
            {
                string localUri = cursor.GetString(cursor.GetColumnIndex(Android.App.DownloadManager.ColumnLocalUri));
                string uri      = cursor.GetString(cursor.GetColumnIndex(Android.App.DownloadManager.ColumnUri));
                long   id       = cursor.GetLong(cursor.GetColumnIndex(Android.App.DownloadManager.ColumnId));
                string filePath = new Uri(localUri).AbsolutePath;

                if (File.Exists(filePath))
                {
                    MBDownloadManager.InstallMbPackage(uri, localUri);
                    downloadManager.Remove(id);
                    //MBDownloadManager.FinishDownload(new Uri(uri), true);
                }
            }

            cursor.Close();
        }
        private static void DownloadMonitor(long downId)
        {
            //bool downloading = true;
            //Android.App.DownloadManager downloadManager = (Android.App.DownloadManager)Application.Context.GetSystemService("download");

            DownloadInfo down = MBDownloadManager.DownloadInfo(downId);

            while (down != null)
            {
                down = MBDownloadManager.DownloadInfo(downId);

                if (down == null)
                {
                    break;
                }

                Uri uri = new Uri(down.Uri);

                if (!MBDownloadManager.pendingRequests.ContainsKey(uri))
                {
                    break;
                }

                switch (down.Status)
                {
                case DownloadStatus.Running:
                case DownloadStatus.Pending:
                    if (MBDownloadManager.pendingRequests.ContainsKey(uri))
                    {
                        List <IDownloadUpdated2> list = MBDownloadManager.pendingRequests[uri];
                        var perc = (int)((down.ByteDownloaded * 100L) / down.ByteTotal);
                        try
                        {
                            foreach (IDownloadUpdated2 current2 in list)
                            {
                                current2.ProgressChanged(perc);
                            }
                        }
                        catch (Exception value)
                        {
                            Console.WriteLine(value);
                        }
                    }
                    break;

                case DownloadStatus.Successful:
                    try
                    {
                        MBDownloadManager.InstallMbPackage(down.Uri, down.LocalUri);
                        //downloadManager.Remove(down.Id);

                        //downloading = false;

                        //MBDownloadManager.RegisterDownload(uri.ToString(), down.LocalUri);

                        //MBDownloadManager.FinishDownload(uri, true);
                    }
                    catch (Exception value)
                    {
                        Console.WriteLine(value);
                        MBDownloadManager.FinishDownload(uri, false);
                    }
                    break;

                default:
                    break;
                }
            }
        }