Android Notification buttons not showing up
Just a reminder for anyone with a similar issue. As per the Android Notifications Guide, notifications can appear in two styles:
- Normal View, where the action buttons don't appear by default (and the user has to expand the notification, in order for them to appear)
- Big View, which is visible if the notification is first in the notification list, or the user has expanded the notification.
Therefore in order to force the notification to appear in Big View, all we have to do is simply place it on the top of the Notifications list. That can be done by setting the When property to 0 which makes it the oldest among notifications! (Sometimes though we may not want this). So call
setWhen(0)
to your notification and you're done.
Let me tell you something which is really awkward. If you have anything in your Ongoing Notification, You wont see the buttons. Typically it happens when you have phone connected to PC via USB. Hope this solves your problem
The buttons won't appear when there is any Ongoing Notification present in the list, such as a media player control, or the IME switcher options when you are editing text.
Luckily, this can be overcome simply by setting the priority of the notification nice and high. I've only ever used Notification.PRIORITY_MAX to get around this, but PRIORITY_HIGH seems to work as well. Set it like this:
Notification notification = new Notification.Builder(myContext)
.setContentTitle(res.getString(R.string.my_title))
.setPriority(Notification.PRIORITY_MAX)
//The rest of your options
.build();