NotificationChannel problème dans Android O
Je suis un toast en disant: "Développeur d'avertissement pour le package com.google.android.des apps.de messagerie" lors de l'envoi d'un MMS à l'aide de Android Messages ver 2.3.063.
Dans les journaux
08-12 16:57:52.368 7661 7682 W Notification: Use of stream types is deprecated for operations other than volume control
08-12 16:57:52.368 7661 7682 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
08-12 16:57:52.369 1604 3146 E NotificationService: No Channel found for pkg=com.google.android.apps.messaging, channelId=miscellaneous, id=5, tag=null, opPkg=com.google.android.apps.messaging, callingUid=10130, userId=0, incomingUserId=0, notificationUid=10130, notification=Notification(channel=miscellaneous pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x8 color=0xff2a56c6 vis=PRIVATE)
08-12 16:57:52.375 1604 3094 D CompatibilityInfo: mCompatibilityFlags - 0
08-12 16:57:52.375 1604 3094 D CompatibilityInfo: applicationDensity - 480
08-12 16:57:52.375 1604 3094 D CompatibilityInfo: applicationScale - 1.0
08-12 16:57:52.378 7661 7682 I BugleNotifications: Notifying for tag = null, type = RESIZING_NOTIFICATION_ID, notification = Notification(channel=miscellaneous pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x8 color=0xff2a56c6 vis=PRIVATE)
08-12 16:57:52.381 7661 8893 W Notification: Use of stream types is deprecated for operations other than volume control
08-12 16:57:52.381 7661 8893 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
08-12 16:57:52.384 1604 1618 E NotificationService: No Channel found for pkg=com.google.android.apps.messaging, channelId=miscellaneous, id=5, tag=null, opPkg=com.google.android.apps.messaging, callingUid=10130, userId=0, incomingUserId=0, notificationUid=10130, notification=Notification(channel=miscellaneous pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x8 color=0xff2a56c6 vis=PRIVATE)
08-12 16:57:52.384 880 1657 W StreamHAL: Error from HAL stream in function get_presentation_position: Operation not permitted
08-12 16:57:52.387 7661 8893 I BugleNotifications: Notifying for tag = null, type = RESIZING_NOTIFICATION_ID, notification = Notification(channel=miscellaneous pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x8 color=0xff2a56c6 vis=PRIVATE)
08-12 16:57:52.390 1604 1647 E NotificationService: No Channel found for pkg=com.google.android.apps.messaging, channelId=miscellaneous, id=5, tag=null, opPkg=com.google.android.apps.messaging, callingUid=10130, userId=0, incomingUserId=0, notificationUid=10130, notification=Notification(channel=miscellaneous pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x48 color=0xff2a56c6 vis=PRIVATE)
Google Play services ver 11.3.02
Android Messages 2.3.063
Android 8.0.0
Quelqu'un là pour m'aider ?
Je suis allé à travers ce stackoverflow.com/questions/44489657/... mais rien ne fonctionne pour moi
Si l'application est en ciblant Android O, toutes les notifications doivent être affichés à l'aide de [Canal de Notification][1]. Sinon, les notifications sont supprimés et ce "Développeur d'avertissement" toast sera affiché dans Android O utilisation de périphériques. [1]: developer.android.com/preview/features/...
Mais je crois que Android app messages, aurait ajouté de notification de prise en charge du canal.
Partager l'extrait de code comment vous montrant la notification.
Related post si vous utilisez l'API de niveau 26+ - NotificationCompat.Générateur de ne pas accepter 2ème argument
Si l'application est en ciblant Android O, toutes les notifications doivent être affichés à l'aide de [Canal de Notification][1]. Sinon, les notifications sont supprimés et ce "Développeur d'avertissement" toast sera affiché dans Android O utilisation de périphériques. [1]: developer.android.com/preview/features/...
Mais je crois que Android app messages, aurait ajouté de notification de prise en charge du canal.
Partager l'extrait de code comment vous montrant la notification.
Related post si vous utilisez l'API de niveau 26+ - NotificationCompat.Générateur de ne pas accepter 2ème argument
OriginalL'auteur Shabbir Panjesha | 2017-08-14
Vous devez vous connecter pour publier un commentaire.
Comme il est écrit dans Android Documentation:
https://developer.android.com/preview/features/notification-channels.html
Pour résoudre ce problème, vous devez créer un NotificationChannel.
Et puis l'assigner à votre Notification comme ceci:
Mise à jour:
Dans le cas où vous souhaitez utiliser NotificationCompat voici un exemple simple:
En fait, vous devez utiliser la Notification Constructeur afin de configurer le canal id via setChannelId();
Il vient de lie le canal de notification que vous venez de créer à la notification.générateur de rapports.
j'ai posté ma question s'il vous plaît aidez-moi https://stackoverflow.com/questions/45711925/failed-to-post-notification-on-channel-null-target-api-is-26
Où/quand dois-je créer le canal de notification? Une fois, à l'application de commencer? Dans l'App#onCreate()?
J'ai été faire une erreur:
Wrong 1st argument type. Found: 'java.lang.String', required: 'int'
dans la lignemNotificationManager.notify(id, notification);
Donc après le passagenotifyID
au lieu deid
je suis maintenant de recevoir des notifications.OriginalL'auteur Milad Moosavi
Messages sur le pain grillé et le Logcat parle de vous, devrait être prêté attention à 2 éléments et de leur ordre:
NotificationChannel mChannel = new NotificationChannel(id, name, importance);
builder = new NotificationCompat.Builder(this, id);
Aussi NotificationManager notifManager et NotificationChannel mChannel sont créés qu'une seule fois.
Il y a requis ouvreurs de Notification:
Voir l'exemple dans Sur Android 8.1 API 27 notification ne s'affiche pas.
OriginalL'auteur Andy Sander
Une autre solution possible consiste à déposer votre targetSdkVersion à 25.
Dernières API niveaux ont apporté que des bâtons et des pas de carottes. Il y a peu de raisons pour les développeurs de cibler de nouvelles api.
Pas vraiment sûr & conseils judicieux étant donné que l'objectif de l'API de niveau est d'être en vigueur dès le 26 à partir de novembre. Envisager d'ajouter cette information à votre post. 🙂
Oui maintenant, Google va commencer à forcer de nous.
OriginalL'auteur miguel