Gần đây, tôi đã cập nhật ứng dụng của mình lên API 26 và thông báo không còn hoạt động nữa mà không cần thay đổi mã.Thông báo Android Không hiển thị trên API 26
val notification = NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_notification)
.setContentTitle("Title")
.setContentText("Text")
.build()
(getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager).notify(1, notification)
Tại sao nó không hoạt động? Có một số thay đổi đối với API mà tôi không biết?
'targetSdkVersion' của bạn là gì? – CommonsWare
@CommonsWare 'targetSdkVersion' 26,' minSdkVersion' 21, 'compileSdkVersion' 26 và' buildToolsVersion' 26.0.0. Tôi cũng đang chạy ứng dụng này trên điện thoại chạy Android O DP3. – Aaron