Android N has a new Cancel Button in the Download Manager Notification.
I would like to excecute some code in my app to stop a progressbar when the user presses this button. If any, which method is called?
Please also note that the Intent filter action DownloadManager.ACTION_NOTIFICATION_CLICKED is triggered only when the user clicks on the notification itself, not when he/she clicks of the Cancel button.
if_downloadManager = new IntentFilter();
if_downloadManager.addAction(DownloadManager.ACTION_DOWNLOAD_COMPLETE);
if_downloadManager.addAction(DownloadManager.ACTION_NOTIFICATION_CLICKED);
br_downloadManager = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) {
....
}
if (DownloadManager.ACTION_NOTIFICATION_CLICKED.equals(action)) {
// This code is not executed when the user presses the Cancel Button in the Download Manager Notification
}
}
};
Thanks in advance.