Android 安卓通知赢得';我没有出现

Android 安卓通知赢得';我没有出现,android,Android,我已经实现了以下方法来在android中显示一些通知。该方法与developer.android.com教程非常相似,但我的通知不会显示在4.1、4.0或2.3上 public void showNotification() { String appname = "App Name"; String title = "Notification Title"; String text = "This is the notification text"; String

我已经实现了以下方法来在android中显示一些通知。该方法与developer.android.com教程非常相似,但我的通知不会显示在4.1、4.0或2.3上

public void showNotification() {
    String appname = "App Name";
    String title = "Notification Title";
    String text = "This is the notification text";
    String iconUrl = "http://url.to.image.com/image.png";
    Bitmap largeIcon = imageCache.getBitmap(iconUrl);
    NotificationManager notifyManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

    TaskStackBuilder stackBuilder = TaskStackBuilder.from(context);
    stackBuilder.addParentStack(NewsActivity.class);
    stackBuilder.addNextIntent(new Intent(context, NewsActivity.class));
    PendingIntent pendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);

    NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
    builder.setContentTitle(title).setContentInfo(appname).setLargeIcon(largeIcon).setContentText(text).setContentIntent(pendingIntent);

    notifyManager.notify("textid", 123, builder.getNotification());
}
A是通知的必需元素

builder.setSmallIcon(R.drawable.notification_icon);
这是状态栏中显示的图标。

尝试以下操作:

notifyManager.notify("textid", 123, builder.build());