Created
May 13, 2020 18:28
-
-
Save mohosyny/3f924cde8eb9818c1ee89f2fe5941259 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lateinit var notification: NotificationCompat.Builder | |
lateinit var manager: NotificationManager | |
val channel = "NotificationTest" | |
lateinit var notificationChannel: NotificationChannel | |
manager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | |
notificationChannel = NotificationChannel(channel, "notification", NotificationManager.IMPORTANCE_DEFAULT) | |
manager.createNotificationChannel(notificationChannel) | |
} | |
notification=NotificationCompat.Builder(this,channel) | |
.setContentTitle("mohosyny") | |
.setContentText("this is for test") | |
.setAutoCancel(true) | |
.setSmallIcon(R.mipmap.ic_launcher) | |
manager.notify(1,notification.build()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment