我无法让Android的大文本通知按此处所述的方式工作:NotificationCompat.BigTextStyle。这里是我用来显示通知的代码。我知道所有数据都可以正确回来,因为我可以将它显示在控制台上并作为传统的内容文本和标题。难道我做错了什么?我是否还需要在其他地方定义bigTestStyle?希望你们之前做过这件事,并知道可能会丢失什么。谢谢。通知大文本Android GCM
我的代码:
NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle();
bigTextStyle.bigText(extras.getString("message"));
NotificationCompat.Builder bigTextNotification = new NotificationCompat.Builder(context)
.setContentTitle("My App")
.setContentIntent(pendingIntent)
.setContentText("Message:")
.setSound(soundUri)
.setTicker(extras.getString("message"))
.setWhen(System.currentTimeMillis())
.setSmallIcon(R.drawable.splash)
.setAutoCancel(true)
.setVibrate(new long[] { 0, 100, 200, 300 })
.setStyle(bigTextStyle);
final int notificationId = (int) (System.currentTimeMillis()/1000L);
NotificationManager thisone = (NotificationManager) getApplicationContext()
.getSystemService(Context.NOTIFICATION_SERVICE);
thisone.notify(notificationId, bigTextNotification.build());
我有一个micromax画布A74,Android版本4.2.2。使用'NotificationCompat'对我很好。但是,当我使用'Notification.Bulider'时,'BigTextStyle'工作正常,但正常的通知样式不起作用。它只是显示没有任何文字的通知图标。 – 2014-08-04 21:12:00