When trying to generate a Notification
in Android Oreo API 27, the following error occurs:
03-12 12:07:48.962 6710-6710/com.exemple.notification W/Notification: Use of stream types is deprecated for operations other than volume control
03-12 12:07:48.963 6710-6710/com.exemple.notification W/Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
All content used is documentation default:
public void notification(View view) {
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this, "1")
.setSmallIcon(R.drawable.food)
.setContentTitle("Titulo")
.setContentText("Conteudo")
.setPriority(NotificationCompat.PRIORITY_DEFAULT);
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
notificationManager.notify(1, mBuilder.build());
}