我有以下用于发送通知的代码...
private void publishNotification(Intent intent, String header, String content){
try {
NotificationManager manager = getNotificationManager();
Notification notification = new Notification(R.drawable.droid, header, System.currentTimeMillis());
if(intent != null){
PendingIntent pendingIntent = PendingIntent.getService(this, 0, intent, Intent.FLAG_ACTIVITY_NEW_TASK);
notification.setLatestEventInfo(this, header, content, pendingIntent);
}
manager.notify(0, notification);
} catch (Exception ex) {
FileManager.writeToLogFile(this.getClass(), "publishNotification", LogMessageType.ERROR, ex.getMessage());
}
}
以及调用它的以下代码......
Intent intent = new Intent();
intent.setAction(DevicePolicyManager.ACTION_SET_NEW_PASSWORD);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
publishNotification(intent, "Default Password Changed", "Device configuration have changed.\nClick here to change this password.");
我的问题如下...
通知出现在通知上,甚至在它被向下滑动之后。问题是当我点击这个通知时,活动没有启动。我想我已经完成了教程中提到的所有事情。我究竟做错了什么 ?