C
C
chrome1232019-05-11 08:28:51
Java
chrome123, 2019-05-11 08:28:51

How to handle button event in Notification on android?

I have a PUSH notification with a button. I can not make it so that when the button is pressed, the method would be called.

Intent iOK= new Intent(this, MainActivity.class);

PendingIntent piOK = PendingIntent.getBroadcast(this, 2, iOK, 0);

 Notification notification = new NotificationCompat.Builder(getApplicationContext(), CHENEL_1_ID)
                .addAction(R.raw.weewqwqe, "OK", piOK)
                .build();
 notificationManager.notify(1, notification);

MainActivity class contains method a(){ } help call it

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question