I currently have an Activity that when it gets displayed a Notification will also get displayed in the Notification bar.
This is so that when the User presses home a
In Kotlin:
val callback = requireActivity().onBackPressedDispatcher.addCallback(this) { // Handle the back button event }
For more information you can check this.
There is also specific question about overriding back button in Kotlin.