【发布时间】:2011-05-04 23:52:33
【问题描述】:
您好,我查看了有关通知的文档,但没有任何帮助。我遵循了建议并将其应用于以下课程:(已评论问题) 我想应用伴随状态栏通知的振动和/LED(状态栏通知确实有效)。当我遵循文档建议时,它指出我必须插入 :otification.defaults |= Notification.DEFAULT_VIBRATE;但是我收到一条错误消息,提示无法将通知解析为变量,如果我将“通知”更改为 note.notification,我根本不会收到任何通知。该应用程序仅在我删除我为您评论的行时运行。我不确定我哪里出错了?谢谢。
公共类 ReminderService 扩展 WakeReminderIntentService {
public ReminderService() {
super("ReminderService");
}
@Override
void doReminderWork(Intent intent) {
Log.d("ReminderService", "Doing work.");
Long rowId = intent.getExtras().getLong(RemindersDbAdapter.KEY_ROWID);
NotificationManager mgr = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Intent notificationIntent = new Intent(this, ReminderEditActivity.class);
notificationIntent.putExtra(RemindersDbAdapter.KEY_ROWID, rowId);
PendingIntent pi = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_ONE_SHOT);
Notification note=new Notification(android.R.drawable.stat_sys_warning, getString(R.string.notify_new_task_message), System.currentTimeMillis());
note.setLatestEventInfo(this, getString(R.string.notify_new_task_title), getString(R.string.notify_new_task_message), pi);
note.defaults |= Notification.DEFAULT_SOUND;
//这是我遇到问题的地方
**notification.defaults |= Notification.DEFAULT_VIBRATE;
notification.ledARGB = 0xff00ff00;
notification.ledOnMS = 300;
notification.ledOffMS = 1000;
notification.flags |= Notification.FLAG_SHOW_LIGHTS;**
note.flags |= Notification.FLAG_AUTO_CANCEL;
【问题讨论】:
标签: android