package Ġcom . example . notes app Ċ Ċ import Ġandroid . app . Notification Channel Ċ import Ġandroid . app . Notification Manager Ċ import Ġandroid . app . Pending Intent Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġandroid . graphics . Color Ċ import Ġandroid . media . Ring tone Manager Ċ import Ġandroid . os . Build Ċ import Ġandroidx . core . app . Notification Compat Ċ Ċ late init Ġvar Ġnotification Channel : ĠNotification Channel Ċ late init Ġvar Ġnotification Manager : ĠNotification Manager Ċ late init Ġvar Ġbuilder : ĠNotification Compat . Builder Ċ Ċ fun ĠContext . show Notification ( channelId : ĠString , Ġtitle : ĠString , Ġbody : ĠString ){ ĊĠĠĠ Ġnotification Manager Ġ= Ġget System Service ( Context . NOTIFICATION _ SERVICE ) Ġas ĠNotification Manager ĊĠĠĠ Ġval Ġintent Ġ= ĠIntent ( this , ĠMainActivity :: class . java ) ĊĠĠĠ Ġval Ġpending Intent Ġ= ĠPending Intent . getActivity ( this , Ġ 0 , Ġintent , ĠPending Intent . FLAG _ UPDATE _ CURRENT ) ĊĠĠĠ Ġif ( Build . VERSION . SDK _ INT Ġ>= ĠBuild . VERSION _ CODES . O ){ ĊĠĠĠĠĠĠĠ Ġnotification Channel Ġ= ĠNotification Channel ( channelId , Ġbody , ĠNotification Manager . IMPORT ANCE _ HIGH ). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlight Color Ġ= ĠColor . BLUE ĊĠĠĠĠĠĠĠĠĠĠĠ Ġenable V ibration ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġnotification Manager . create Notification Channel ( notification Channel ) ĊĠĠĠĠĠĠĠ Ġbuilder Ġ= ĠNotification Compat . Builder ( this , Ġchannel Id ). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġset Small Icon ( R . drawable . ic _ report ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġset Content Title (" notes Ġclient ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġset Content Text ( body ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġset Auto Cancel ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġset Sound ( Ring tone Manager . getDefault Uri ( Ring tone Manager . TYPE _ RING T ONE )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġset Content Intent ( pending Intent ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠĠĠ Ġnotification Manager . notify ( channelId . toInt (), Ġbuilder . build ()) Ċ }