only setting notification channel for supported android versions
This commit is contained in:
parent
7e82cf1569
commit
50f0ba4e3c
|
@ -2,6 +2,7 @@ package app.dapk.st.notifications
|
|||
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.os.Build
|
||||
|
||||
private const val channelId = "message"
|
||||
|
||||
|
@ -10,14 +11,16 @@ class NotificationChannels(
|
|||
) {
|
||||
|
||||
fun initChannels() {
|
||||
if (notificationManager.getNotificationChannel(channelId) == null) {
|
||||
notificationManager.createNotificationChannel(
|
||||
NotificationChannel(
|
||||
channelId,
|
||||
"messages",
|
||||
NotificationManager.IMPORTANCE_HIGH,
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
if (notificationManager.getNotificationChannel(channelId) == null) {
|
||||
notificationManager.createNotificationChannel(
|
||||
NotificationChannel(
|
||||
channelId,
|
||||
"messages",
|
||||
NotificationManager.IMPORTANCE_HIGH,
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue