Android Question Android Download manager

Discussion in 'Android Questions' started by Devv, Mar 7, 2015.

  1. Devv

    Devv Active Member Licensed User

    i'am trying to download a file and open my app when the download notification is clicked

    this is what i tried

    'Activity module
    Sub Process_Globals

    Dim DOWNLOAD_ADDRESS As String=""
    Dim DOWNLOAD_FILENAME As String="wiki_logo.png"
    '    DownloadId is a unique identifier assigned by the DownloadManager to this download task
        Dim DownloadId As Long
    End Sub

    Sub Globals
    Dim DownloadButton As Button
    Dim DownloadManager1 As DownloadManager
    Dim ImageView1 As ImageView
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
    '    RegisterReceiver enables DownloadManager to raise events
    End Sub

    Sub Activity_Resume

    End Sub

    Sub Activity_Pause (UserClosed As Boolean)

    End Sub

    Sub DownloadButton_Click

    Dim DownloadManagerRequest1 As DownloadManagerRequest
    "DownloadManager demo"
    '    save the download to external memory
        '    note you must manually update your project's manifest file adding android.permission.WRITE_EXTERNAL_STORAGE
        DownloadManagerRequest1.DestinationUri="file://"&File.Combine(File.DirRootExternal, DOWNLOAD_FILENAME)
    End Sub

    Sub DownloadManager1_DownloadComplete(DownloadId1 As Long)
    '    this does not guarantee that the download has actually successfully downloaded
        '    it means a DownloadMananger DownloadManagerRequest has completed
        '    we need to find that status of that request but only if that request matches the request we started
    If DownloadId=DownloadId1 Then
    ToastMessageShow("finished downlaoding",False)
    End If
    End Sub

    Sub DownloadManager1_NotificationClicked (DownloadIds() As Long)
    ToastMessageShow("you clicked notification",False)
    End Sub

    the download is working and i'am getting a toast when the download complete , but i never get any toast when i click the download notification , any ideas ?
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice