我实现了来自 Google 通知示例的代码示例。它在 Android 4.2.2 之前运行良好,但从 4.3 开始就没有(在我的 Nexus 7 2013 上)......我是唯一一个遇到这个问题的人吗?我错过了新的通知方法吗?这是我的简单代码:
final int NOTIFICATION_ID = 1;
NotificationManager mNotificationManager;
mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, HomeActivity.class), 0);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.icon)
.setContentTitle("Title")
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(""))
.setContentText("Message");
mBuilder.setContentIntent(contentIntent);
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
谢谢 !