package Ġcom . d orm m om . flutter _ mapbox _ navigation Ċ Ċ /* class ĠCustom Navigation Notification ( application Context : ĠContext ) Ġ: ĠNavigation Notification Ċ { ĊĠĠĠ Ġprivate Ġval ĠCUSTOM _ NOTIFICATION _ ID Ġ= Ġ 8 4 5 7 4 5 1 5 2 ĊĠĠĠ Ġprivate Ġval ĠSTOP _ NAV IG ATION _ ACTION Ġ= Ġ" stop _ navigation _ action " ĊĠĠĠ Ġprivate Ġval ĠCUSTOM _ CHANNEL _ ID Ġ= Ġ" custom _ channel _ id " ĊĠĠĠ Ġprivate Ġval ĠCUSTOM _ CHANNEL _ NAME Ġ= Ġ" custom _ channel _ name " ĊĊĠĠĠ Ġprivate Ġvar Ġcustom Notification : ĠNotification ĊĠĠĠ Ġprivate Ġvar Ġcustom Notification Builder : ĠNotification Compat . Builder ? Ġ= Ġnull ĊĠĠĠ Ġprivate Ġvar Ġnotification Manager : ĠNotification Manager ? Ġ= Ġnull ĊĠĠĠ Ġprivate Ġval Ġstop Navigation Receiver : ĠBroadcast Receiver ? Ġ= Ġnull ĊĠĠĠ Ġprivate Ġvar ĠnumberOf Updates Ġ= Ġ 0 ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ Ġnotification Manager Ġ= Ġapplication Context . getSystem Service ( Context . NOTIFICATION _ SERVICE ) Ġas ĠNotification Manager ĊĠĠĠĠĠĠĠ Ġif Ġ( Build . VERSION . SDK _ INT Ġ>= ĠBuild . VERSION _ CODES . O ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġnotification Channel Ġ= ĠNotification Channel ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠCUSTOM _ CHANNEL _ ID , ĠCUSTOM _ CHANNEL _ NAME , ĠNotification Manager . IMPORT ANCE _ LOW ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnotification Manager ?. create Notification Channel ( notification Channel ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġcustom Notification Builder Ġ= ĠNotification Compat . Builder ( application Context , ĠCUSTOM _ CHANNEL _ ID ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Small Icon ( R . drawable . ic _ navigation ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. setContent Title (" Custom ĠNavigation ĠNotification ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. setContent Text (" Display Ġyour Ġown Ġcontent Ġhere !") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. setContent Intent ( create Pending Stop Intent ( application Context )) ĊĠĠĠĠĠĠĠ Ġcustom Notification Ġ= Ġcustom Notification Builder ?. build () !! ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Navigation Stopped ( context : ĠContext ): Ġkotlin . Unit Ġ{ ĊĠĠĠĠĠĠĠ Ġcontext ?. unregister Receiver ( stop Navigation Receiver ); ĊĠĠĠĠĠĠĠ Ġnotification Manager ?. cancel ( CUSTOM _ NOTIFICATION _ ID ); ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġget Notification Id (): ĠInt Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠCUSTOM _ NOTIFICATION _ ID ; ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġget Notification (): ĠNotification Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġcustom Notification ; ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġupdate Notification ( route Progress : ĠRoute Progress ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcustom Notification Builder ?. setContent Text (" Number Ġof Ġupdates : Ġ" Ġ+ ĠnumberOf Updates ++); ĊĠĠĠĠĠĠĠ Ġnotification Manager ?. notify ( CUSTOM _ NOTIFICATION _ ID , Ġcustom Notification Builder ?. build ()); ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġcreate Pending Stop Intent ( context : ĠContext ): ĠPending Intent ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstop Navigation Intent Ġ= ĠIntent ( STOP _ NAV IG ATION _ ACTION ) ĊĠĠĠĠĠĠĠ Ġreturn ĠPending Intent . get Broadcast ( context , Ġ 0 , Ġstop Navigation Intent , Ġ 0 ) ĊĠĠĠ Ġ} Ċ Ċ } ĊĊ Ġ*/