在我的应用程序关闭之前,我如何保持Android通知的显示?
我为Android开发了一段时间,但这是我第一次尝试使用通知。我已经按照Android SDK教程中的说明设置了通知,但我不知道如何在关闭应用程序之前保持通知的显示。我想禁用通知末尾的那个小减号。我不希望我的通知在用户单击时消失。我想会有一个通知标志。。。但我似乎无法理解这一点。我正在开发Android SDK 2.2。我知道这是一个简单的问题,如果这个答案已经在这里,我道歉。。。我没能找到我要找的东西在我的应用程序关闭之前,我如何保持Android通知的显示?,android,notifications,notificationmanager,Android,Notifications,Notificationmanager,我为Android开发了一段时间,但这是我第一次尝试使用通知。我已经按照Android SDK教程中的说明设置了通知,但我不知道如何在关闭应用程序之前保持通知的显示。我想禁用通知末尾的那个小减号。我不希望我的通知在用户单击时消失。我想会有一个通知标志。。。但我似乎无法理解这一点。我正在开发Android SDK 2.2。我知道这是一个简单的问题,如果这个答案已经在这里,我道歉。。。我没能找到我要找的东西 // Create notification manager String
// Create notification manager
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
Notification notification = new Notification(R.drawable.ic_launcher, "Ready", System.currentTimeMillis());
Intent notificationIntent = new Intent(this, HomeActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
// Make a notification
notification.setLatestEventInfo(getApplicationContext(), "Ready", "Select to manage your settings", contentIntent);
mNotificationManager.notify(0, notification);
你想要的。如果它们是默认设置的一部分,请尝试删除FLAG\u NO\u CLEAR和FLAG\u AUTO\u CANCEL。我因重新发布了一个有我答案的问题而正式有罪:。。。。。谢谢你。FLAG_NO_CLEAR是我找不到的那个。该死notification.flags |=notification.FLAG_持续事件;notification.flags&=~notification.FLAG\u否\u清除;notification.flags&=~notification.FLAG\u AUTO\u CANCEL;