Can't add builder for NotificationCompat

I am trying to add a notification. I am following this: .
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)

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