Home Menu

Menu



Discusión general sobre Android Exclusivo para hablar de Android


 
Herramientas
  #1  
Viejo 01/02/21, 20:27:08
Avatar de lhdezg91
lhdezg91 lhdezg91 no está en línea
Usuario poco activo
Mensajes: 1
 
Fecha de registro: ene 2019
Mensajes: 1
Modelo de smartphone: Alcatel A3 Plus
Tu operador: Otra
Mencionado: 0 comentarios
Tagged: 0 hilos
boton de accion en una notificacion en android studio kotlin

Hola amigos quiero que mi notificacion tenga un boton Actualizar que cuando lo oprima este ejecute un metodo y actualice el contenido de la notificacion, sale el boton pero cuando le doy no ejecuta nada, este es mi codigo, pero no entiendo como hacer que funcione
Código:
    val snoozeIntent = Intent(this, MainActivity::class.java).apply {
        action = "" //<- aqui es donde no se que poner para que me ejecute el metodo
        putExtra(EXTRA_NOTIFICATION_ID, 0)            
    }
    val snoozePendingIntent: PendingIntent =
        PendingIntent.getBroadcast(this, 0, snoozeIntent, 0)

    var builder = NotificationCompat.Builder(this, "default")
        .setSmallIcon(R.drawable.ic_notificacion)            
        .setOnlyAlertOnce(true)
        .setVisibility(NotificationCompat.VISIBILITY_SECRET)
        .setOngoing(true)
        .setColor(resources.getColor(R.color.colorAccent))
        .setStyle(
            NotificationCompat.BigTextStyle()
                .bigText(TEXT)
        )
        .addAction(R.drawable.ic_notificacion, "Actualizar",
            snoozePendingIntent)
        .setPriority(NotificationCompat.PRIORITY_DEFAULT)
        .setContentIntent(pendingIntent)
        .setAutoCancel(true)
Responder Con Cita


Respuesta

Estás aquí
Regresar   HTCMania > Todo sobre Android > Discusión general sobre Android


Reglas de Mensajes
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Las caritas están On
Código [IMG] está On
Código HTML está Off

Saltar a Foro



Hora actual: 05:43:56 (GMT +1)

Cookies
Powered by vBulletin™
Copyright © vBulletin Solutions, Inc. All rights reserved.
 
HTCMania: líderes desde el 2007