Android 通知在ICS 4.0(API 14)中不显示时间

Android 通知在ICS 4.0(API 14)中不显示时间,android,android-notifications,Android,Android Notifications,我正在使用以下代码显示通知 NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_stat_name) .setContentTitle("My notification") .setContentText("Hello

我正在使用以下代码显示通知

NotificationCompat.Builder mBuilder =
                new NotificationCompat.Builder(this)
                .setSmallIcon(R.drawable.ic_stat_name)
                .setContentTitle("My notification")
                .setContentText("Hello World!");
Intent resultIntent = new Intent(this, MainActivity.class);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(1, mBuilder.build());
根据/

问题是我没有在通知中获得
defalut时间

--------------解决方法------------------

使用
System.currentTimeMillis()
获取当前时间,然后将其传递给
when()


让我知道这是否可以在没有解决方法的情况下解决。:)

这是早期版本的ICS中的一个bug;从版本4.0.3()开始,时间戳应再次出现。

但您不使用setWhen();现在…根据文档,它不是必需的,如果你想显示默认时间,你必须使用变通方法来支持市场上的所有设备:)在野外不应该有那么多4.0.0设备;快速查看显示,几乎所有ICS设备都在4.0.3+上。是的,但这在任何ICS版本上都不起作用。我使用的是4.0.4:)
You can set an explicit value with setWhen();
if you don't it defaults to the time that the system received the notification.
long curr_time = System.currentTimeMillis();

mBuilder.setWhen(curr_time);