son que puntos punto oreo notificaciones notificacion los globo flotantes barra android android-8.0-oreo

android - puntos - que es el punto de notificacion



La notificación de Android Oreo sigue haciendo sonido incluso si no configuro el sonido. En la versión anterior, funciona perfectamente. (4)

Echa un vistazo a la configuración del canal de notificación (desliza tu notificación y presiona el ícono de configuración debajo de él y luego selecciona tu canal). Esos ajustes se establecen la primera vez que creas el canal y luego no se modifican, a menos que lo hagas manualmente en el dispositivo (al menos esa es mi experiencia al desinstalar y reinstalar mi aplicación para ver qué ajustes obtengo de forma predeterminada).

Básicamente, channel.setSound(null, null) solo tendrá efecto cuando cree el canal en una instalación nueva . Eso podría ser lo que intentan explicar en la guía oficial :

El intento de crear un canal de notificación existente con sus valores originales no realiza ninguna operación

Si intentó seguir esa guía y establecer NotificationManager.IMPORTANCE_HIGH y no usó channel.setSound(null, null) , el canal obtendría un nivel de importancia Urgent Make sound and pop on screen con el sonido predeterminado.

Entonces estoy haciendo mi aplicación compatible con Oreo y enfrentando el problema con la notificación.

Agregué el canal de notificación de acuerdo con la documentación y todo funciona sin problemas, excepto que las notificaciones siguen haciendo ruido en cada publicación, también intenté establecer los valores predeterminados en 0.

Estoy probando mi aplicación en el emulador, cualquier ayuda es muy apreciada.

Utiliza este código para crear canal.

NotificationCompat.Builder builder = new NotificationCompat.Builder(PlayerService.this, "channel_01") .setAutoCancel(false) .setContentIntent(pendingIntent) .setContent(viewsSmall) .setCustomBigContentView(viewsExpanded) .setDeleteIntent(pSwipeToDismiss); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { builder.setVisibility(Notification.VISIBILITY_PUBLIC); } if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { builder.setPriority(Notification.PRIORITY_MAX); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { /* Create or update. */ NotificationChannel channel = new NotificationChannel("channel_01", "Playback Notification", NotificationManager.IMPORTANCE_DEFAULT); mNotificationManager.createNotificationChannel(channel); mBuilder.setChannelId("channel_01"); } final Notification notification = builder.build(); startForeground(Constants.NOTIFICATION_ID.FOREGROUND_SERVICE,notification);



Reemplace su código con este

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { /* Create or update. */ NotificationChannel channel = new NotificationChannel("channel_01", "Playback Notification", NotificationManager.IMPORTANCE_LOW); channel.setSound(null, null); mNotificationManager.createNotificationChannel(channel); mBuilder.setChannelId("channel_01"); }


^ La respuesta de Benjamin funciona, pero le faltan algunos detalles importantes. Debe cambiar su ID de canal cada vez que ajuste su código, de lo contrario Oreo no realizará los cambios. No estoy seguro de por qué.

Mi código a continuación y puede ver dónde se debe hacer el cambio con este <------- aquí

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { String channelID = "My Channel I"; <-------here String appName = mContext.getResources().getString(R.string.app_name); NotificationCompat.Builder notificationCompatBuilder = new NotificationCompat.Builder(mContext ); notificationCompatBuilder .setOngoing(true) .setContentTitle(mContext.getResources().getString(R.string.app_name)) .setContentText(mContext.getString(R.string.clocked_in)) .setSmallIcon(R.drawable.ic_action_name) .setChannelId(channelID) .setSound(null); NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); NotificationChannel notificationChannel = new NotificationChannel(channelID, appName, NotificationManager.IMPORTANCE_LOW); notificationChannel.setSound(null, null); notificationManager.createNotificationChannel(notificationChannel); notificationManager.notify(ONGOINGNOTIFICATION_ID, notificationCompatBuilder.build()); }