How to add button on Foreground Service Notification to Kill the Service on Android
I am building an app on Kotlin, and when I start my foreground service, I get a notification that it is running. How can I add a button to that notification, which when clicked by the user will terminate that foreground service?
private fun createNotificationChannel() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val notificationChannel = NotificationChannel(
notificationChannelId,
"App Name",...