我已經寫了通知功能,並顯示在通知欄:Android的 - 保持通知持穩在通知欄
private void showNotification()
{
CharSequence title = "Hello";
CharSequence message = "Notification Demo";
NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.icon, "A Notification", System.currentTimeMillis());
Intent notificationIntent = new Intent(this, Main_Activity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(Main_Activity.this, title, message, pendingIntent);
notificationManager.notify(NOTIFICATION_ID, notification);
}
其工作正常,但what way we can keep the notification steady at Notification bar
甚至當用戶按下「清除」 notificatios按鈕從通知欄?
請查看「雅虎」應用程序的通知欄。
我曾經使用過此SDK文章了:http://developer.android.com/guide/topics/ui/notifiers/notifications.html#Updating,但未能找到。
你確定保持通知穩定是個好主意嗎? – 2011-03-17 11:49:47
@Heiko Rupp抱歉地說是的,但它的實際要求,我必須執行。 – 2011-03-17 12:00:39
讀者應該清楚這一點:使用它來宣傳你的應用程序將激怒你的用戶,它只應用於你需要提供一致的快速訪問來控制正在運行的服務。例如:音樂應用程序(僅在播放某些內容時),導航(僅在導航路線時)或GPS記錄器(在記錄時)。 – 2013-05-28 08:09:46