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);
    }

Все работает нормально, но каким образом мы можем поддерживать постоянное уведомление на панели уведомлений даже когда пользователь нажимает кнопку «очистить» уведомления на панели уведомлений?

Пожалуйста, посмотрите на панель уведомлений приложения «Yahoo».

enter image description here

Я прочитал эту статью SDK: http: // developer. android.com/guide/topics/ui/notifiers/notifications.html#Updating, но не смог узнать.

11
задан Paresh Mayani 17 March 2011 в 11:40
поделиться