我正在尝试创建一个 JB 通知,但我无法让它显示,并且它不会在 logcat 中给出任何错误,只是它什么都不做。
我用来创建通知的代码如下
private void bigPictureNotification(){
Notification.Builder builder;
Notification notification;
NotificationManager manager;
Intent intent = new Intent(this, NotificationPendingIntent.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
//carica l'immagine
Bitmap icon = BitmapFactory.decodeResource(getApplicationContext().getResources(), R.drawable.androidworld);
builder = new Notification.Builder(getApplicationContext());
builder.setContentTitle("Titolo piccolo");
builder.setContentText("Testo della notifica");
builder.setSmallIcon(R.drawable.ic_stat_notifica);
builder.setLargeIcon(icon);
builder.addAction(R.drawable.ic_action_search, "Cerca", pendingIntent);
builder.addAction(R.drawable.ic_stat_notifica, "AndroidWorld", pendingIntent);
builder.addAction(R.drawable.ic_launcher, "Launcher", pendingIntent);
builder.build();
notification = new Notification.BigPictureStyle(builder).bigPicture(icon).build();
//notification = builder.build();
notification.flags = Notification.FLAG_AUTO_CANCEL;
manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
manager.notify(0, notification);
}
错误在哪里?谢谢您的帮助