问题
Android N brought the "cancel" feature directly on the download notification if you're using the DownloadManager.
Did they add any intent-filter action to catch this event ?
At this point DownloadManager gets only 3 actions :
ACTION_DOWNLOAD_COMPLETE
ACTION_NOTIFICATION_CLICKED
ACTION_VIEW_DOWNLOADS
I tried to use ACTION_NOTIFICATION_CLICKED
to cancel manually my download but if the user clicks on the "Cancel" button, I'm not notified.
回答1:
The DownloadManager should send ACTION_DOWNLOAD_COMPLETE
broadcast to your app if user click on Cancel. But it is a known bug in Android N, Android team is working on it:
Issue 219785: DownloadManager dose't send ACTION_DOWNLOAD_COMPLETE broadcast while click CANCEL button on notification to cancel the downloading.
We have to wait for fix!
来源:https://stackoverflow.com/questions/39231544/downloadmanager-and-android-7-0-cancel-feature