Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notification action buttons appereance

How to make the notification buttons to appear as they are supposed to (like on the 2nd notification on the image below)?

This is my code:

Notification.Builder nb = new Notification.Builder(mCtx);
    nb.setTicker("DATART");
    nb.setSmallIcon(R.drawable.ic_menu_info_details_select);
    nb.setContentText("DATART text");
    nb.setContentTitle(mCtx.getString(R.string.app_name));
    nb.setContentIntent(getClickIntent());
    nb.setAutoCancel(true);
    nb.setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_SOUND);
    nb.setLights(LED, LEDON, LEDOFF);
    nb.addAction(android.R.drawable.ic_btn_speak_now, "Prihodit", PendingIntent.getActivity(mCtx, 0, new Intent(mCtx, AuctionProductDetail.class), 0));
    nb.addAction(android.R.drawable.ic_dialog_map, "Mapa", PendingIntent.getActivity(mCtx, 0, new Intent(mCtx, AuctionProductDetail.class), 0));
    return nb.build();

Notification

like image 818
martinpelant Avatar asked Nov 03 '22 19:11

martinpelant


1 Answers

Looks like I have to set the android:targetSdkVersion to 11 or above

like image 172
martinpelant Avatar answered Nov 17 '22 19:11

martinpelant