Interactive Notifications with custom buttons on Android

Hello,

 

I have been trying to make custom buttons for Interactive Notifications, but it's not working and I can't figure out why. I have done everything the doc says (http://docs.urbanairship.com/platform/android.html#interactive-notifications), and tried some tricks, but it sill not working. Here is my code :

public class NayshowApp extends Application {

@Override
public void onCreate() {
super.onCreate();

UAirship.takeOff(this, new UAirship.OnReadyCallback() {
@Override
public void onAirshipReady(UAirship airship) {
// Enable user notifications
airship.getPushManager().setUserNotificationsEnabled(!Utils.getPrefBooleanDefaultFalse(NayshowApp.this, Constants.NOTIFICATIONS, Constants.NOTIFICATIONS_DISABLED));
}
});

NotificationActionButton hiButtonAction = new NotificationActionButton.Builder("hi")
.setLabel(R.string.label_headline)
.setIcon(R.drawable.image_error)
.setPerformsInForeground(true)
.build();

NotificationActionButton byeButtonAction = new NotificationActionButton.Builder("bye")
.setLabel(R.string.label_no_result)
.setIcon(R.drawable.ns_icon)
.setPerformsInForeground(true)
.build();

// Define the group
NotificationActionButtonGroup buttonGroup = new NotificationActionButtonGroup.Builder()
.addNotificationActionButton(hiButtonAction)
.addNotificationActionButton(byeButtonAction)
.build();

// Add the custom group
UAirship.shared().getPushManager().addNotificationActionButtonGroup("custom group", buttonGroup);

}

}

 

Then I set up my notification with eveything except with the buttons because I custom them in my code : http://i.imgur.com/3JcOsAw.png

 

And it does not work, the notification has no button. And I really do not understand how I could make it work.

Thanks for your help !

 

Didn't find what you were looking for?

New post

Comments

4 comments

  • Well I managed to do it, I needed to create a button on Airship Website, then implement my code. Maybe a line to precise this in the doc would be great!

    0
  • Julien,

    Good to hear you got it resolved!

    For future reference, you can use the Composer Guide for setting up not only the custom interactive buttons, but also deep-links and in-app messages.

    0
  • Wow I missed that one. Thanks for the tips!

    0
  • No problem!

    0

Please sign in to leave a comment.