Android notification not showing on API 26

I recently upgraded my application to API 26, and notifications no longer work without even changing the code.

val notification = NotificationCompat.Builder(this)
                .setSmallIcon(R.drawable.ic_notification)
                .setContentTitle("Title")
                .setContentText("Text")
                .build()
(getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager).notify(1, notification)

Why doesn't it work? Have there been some API changes that I don't know about?

+6
source share
1 answer

From the documentation :

Android O , . Android O, . Android O, , Android 7.0 Android O.

( )

, Notification .

+11

All Articles