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.NotificationChannel
|
||||||
import android.app.NotificationManager
|
import android.app.NotificationManager
|
||||||
|
import android.os.Build
|
||||||
|
|
||||||
private const val channelId = "message"
|
private const val channelId = "message"
|
||||||
|
|
||||||
|
@ -10,6 +11,7 @@ class NotificationChannels(
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun initChannels() {
|
fun initChannels() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
if (notificationManager.getNotificationChannel(channelId) == null) {
|
if (notificationManager.getNotificationChannel(channelId) == null) {
|
||||||
notificationManager.createNotificationChannel(
|
notificationManager.createNotificationChannel(
|
||||||
NotificationChannel(
|
NotificationChannel(
|
||||||
|
@ -20,5 +22,6 @@ class NotificationChannels(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue