martinpelant
martinpelant

Reputation: 2981

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

Upvotes: 5

Views: 3975

Answers (1)

martinpelant
martinpelant

Reputation: 2981

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

Upvotes: 2

Related Questions