Can't add builder for NotificationCompat

Hello,
I am trying to add a notification. I am following this: https://developer.android.com/training/notify-user/build-notification .
I have implemented this implementation 'androidx.core:core-ktx:1.7.0' in gradle and this in my fragment

var builder = NotificationCompat.Builder(this, CHANNEL_ID)
        .setSmallIcon(R.drawable.notification_icon)
        .setContentTitle("Test")
        .setContentText("TestContent")
        .setPriority(NotificationCompat.PRIORITY_DEFAULT)

But Builder is always red and it says “Unresolved reference: Builder”.

Maybe someone has an idea.
Thank you

I think it’s because you define the CHANNEL_ID as an integer and not a string.

Went through the same issue and that was my problem. Hope it helps :wink:

private var CHANNEL_ID = "22222"
//instead of 
private var CHANNEL_ID = 22222