I am currently working with an Android service: https://developer.android.com/guide/components/services
I am creating a service that has to be a foreground service. But looking at the documentation, a foreground service requires a notification channel.
But a notification channel is only on api 26 or higher. How can i create a notification channel for < 26?
I am stuck with this code
if (VERSION.SDK_INT >= 26) {
getSystemService(NotificationManager.class).createNotificationChannel(new NotificationChannel("ServiceWorker", "ServiceWorker", NotificationManager.IMPORTANCE_DEFAULT));
}