Is there a way to handle button clicks from Backendless push notification in code and how to do it?

98 Views Asked by At

I'm building android application with push notifications using Backendless as backend. I encountered a problem with handling buttons. I know that I can push notification with template(from Backendless Console) and there is an option to handle clicks, but I wonder if there is an option to do it all in code, not with template?

I have also searched for similar questions but everything I found was old and deprecated.
image

I use this function to push notification but I don't know how to set buttons and how to handle button clicks.

public static void sendPushNotification(String channel, String message, String header,
                                            List<String> devices) {

        DeliveryOptions deliveryOptions = new DeliveryOptions();
        deliveryOptions.setPushSinglecast(devices);

        PublishOptions publishOptions = new PublishOptions();
        publishOptions.putHeader("android-ticker-text", header);
        publishOptions.putHeader("android-content-title", header);
        publishOptions.putHeader("android-content-text", message);

        Backendless.Messaging.publish(channel, message, publishOptions, deliveryOptions,
                new AsyncCallback<MessageStatus>() {
            @Override
            public void handleResponse(MessageStatus response) {
            }

            @Override
            public void handleFault(BackendlessFault fault) {
            }
        });
    }

Solution : https://support.backendless.com/t/customise-push-notification/10863/20

1

There are 1 best solutions below

0
On

I finally found answer, if you had similar problem please go here and check: https://support.backendless.com/t/customise-push-notification/10863/20