En la notificación de búsqueda de progreso no se muestra en DownloadManager android

Estoy descargando el archivo desde webview. Pero no se muestra la notificación de descarga en curso similar a esto cuando se utiliza DownloadManager. Sólo está haciendo en la operación de fondo. Cómo mostrar la notificación de la barra de estado cuando se está realizando la descarga. ¿Puedo conseguir el archivo descargado pero cómo exhibir el proceso en curso en la notificación?

He utilizado "request.setNotificationVisibility (DownloadManager.Request.VISIBILITY_VISIBLE);" Pero no está mostrando el proceso en curso. Por favor, guíame qué error estoy haciendo.

Aquí está mi código que utilicé.

mWebview.setDownloadListener(new DownloadListener() { @Override public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { DownloadManager.Request request = new DownloadManager.Request( Uri.parse(url)); request.setMimeType("pdf"); String cookies = CookieManager.getInstance().getCookie(url); request.addRequestHeader("cookie", cookies); request.addRequestHeader("User-Agent", userAgent); request.setDescription("Downloading file..."); request.setTitle(URLUtil.guessFileName(url, contentDisposition, "pdf")); request.allowScanningByMediaScanner(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { //clueless why it's not working.. request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE); } else { request.setShowRunningNotification(true); } //request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); request.setDestinationInExternalPublicDir( Environment.DIRECTORY_DOWNLOADS, URLUtil.guessFileName( url, contentDisposition, "pdf")); dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE); downloadReference = dm.enqueue(request); IntentFilter filter = new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE); registerReceiver(downloadReceiver, filter); } }); } private BroadcastReceiver downloadReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { long referenceId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1); if (downloadReference == referenceId) { DownloadManager.Query q = new DownloadManager.Query(); q.setFilterById(intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1)); Cursor c = dm.query(q); if (c.moveToFirst()) { int status = c.getInt(c.getColumnIndex(DownloadManager.COLUMN_STATUS)); if (status == DownloadManager.STATUS_SUCCESSFUL) { // process download String title = c.getString(c.getColumnIndex(DownloadManager.COLUMN_TITLE)); File file = new File(Environment.getExternalStorageDirectory() + "/Download/" + title);//name here is the name of any string you want to pass to the method if (!file.isDirectory()) file.mkdir(); //Intent testIntent = new Intent("com.adobe.reader"); Intent testIntent = new Intent(Intent.ACTION_VIEW); testIntent.setType("application/pdf"); //testIntent.setAction(Intent.ACTION_VIEW); Uri uri = Uri.fromFile(file); testIntent.setDataAndType(uri, "application/pdf"); try { startActivity(testIntent); } catch (ActivityNotFoundException e) { Toast.makeText(MainActivity.this, "No application available to view PDF", Toast.LENGTH_SHORT).show(); } // get other required data by changing the constant passed to getColumnIndex } } } } }; 

Comprobé en Android 7.1.1.

Sí encontré la solución. El problema es no habilitado gestor de descargas.

 Go to the Settings > App In the options click 'Show System Apps' Find 'Download Manager' and open it Click 'Notifications' under App Settings Switch on Allow Notifications 

Referencia:

https://stackoverflow.com/a/43841708/1921263

  • Cómo programar la notificación en Android
  • Cómo cerrar la notificación después de hacer clic en la acción
  • todos Huawei, Honor, Xiaomi en Marshmallow: Notificación icono pequeño siempre establecido en el icono de la aplicación
  • Tamaño grande del icono de la notificación del empuje de GCM
  • ¿Cómo borro las notificaciones usando el shell de ADB?
  • Texto Ticker NotificationCompat que no se muestra al actualizar notificación
  • ¿Cómo iniciar una notificación junto con AlarmManager?
  • La notificación android lanza la misma actividad dos veces
  • Notificación personalizada con diseño dinámico en la vista remota
  • Cómo agregar el botón directamente en Notificación en Android Wear
  • Iniciar una actividad de notificación destruye las actividades de los padres
  • FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.