Created
June 8, 2021 23:19
-
-
Save victorbrndls/96b02353e8bf827bff0188c30087f5ac to your computer and use it in GitHub Desktop.
This file contains 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
private const val CHANNEL_ID = "heads_up_alerts" | |
private const val CHANNEL_NAME = "Heads Up Alerts" | |
private val notificationManager = NotificationManagerCompat.from(context) | |
private fun createNotificationChannel() { | |
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return | |
val channel = NotificationChannel( | |
CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH | |
).apply { | |
lockscreenVisibility = Notification.VISIBILITY_PUBLIC | |
} | |
notificationManager.createNotificationChannel(channel) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment