【发布时间】:2013-02-07 07:56:02
【问题描述】:
已确认以下代码可在运行 HONEYCOMB+ 的设备上正常工作。但是在三星 Galaxy Y 上,它不会产生任何通知。
String tickerText = userString + " Download Queued";
Notification notification = new NotificationCompat.Builder(this).setAutoCancel(true)
.setContentTitle(userString)
.setContentText("Queued")
.setSmallIcon(R.drawable.stat_sys_download_done)
.setWhen(System.currentTimeMillis())
.setTicker(tickerText)
.build();
if(DBG_ENABLE) {
LogUtils.logD(TAG_LOG, "Posting queue notification : " + 0);
}
NotificationManager notificationManager =
(NotificationManager) getApplicationContext().getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(0, notification);
注意:
- 我在日志中看到“发布队列通知”。
- 我已将可绘制的
stat_sys_download_done从 android sdk 复制到我的项目中。
我想不出调试此问题的方法。我不确定我是否缺少任何东西。任何解决此问题的建议表示赞赏。
【问题讨论】:
-
看起来不错。在 2.3 模拟器上试一试。
标签: android notifications fragmentation