Вы просто должны используйте NotificationCompat.Builder builder вместо Builder Notification.Builder, потому что Нет tificationCompat.Builder позволяет создавать приложения под Android версии 4.1
решаемые с помощью NotificationCompat.builder:
String strTitle = getString(R.string.new_message);
String strText = getString(R.string.hi_whats_up);
Intent intent = new Intent(this, NotificationView.class);
intent.putExtra("title", strTitle);
intent.putExtra("text", strText);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_launcher)
.setTicker("Notification Ticker")
.setContentTitle("Notification Title")
.setContentText("Notification Text")
.addAction(R.mipmap.ic_launcher, "Notification Action", pendingIntent)
.setContentIntent(pendingIntent)
.setAutoCancel(true);
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(0, builder.build());
В соответствии с [документы] (http://developer.android.com/reference/android /app/Notification.Builder.html#addAction%28android.app.Notification.Action%29), вы должны использовать 'addAction (Notification.Action action)' вместо этого. – Tigger
http://stackoverflow.com/questions/16852270/how-to-implement-the-deprecated-methods-of-notification – sasikumar
Я уже посмотрел на этот пример @sasikumar, это мне не помогает, я не понимаю как создать 'Notification.Action action' –