He escrito la función de notificar y exhibición en barra de notificaciones:Android - Mantener la notificación estable en la barra de notificación
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);
}
Su trabajo bien, pero what way we can keep the notification steady at Notification bar
incluso cuando el usuario pulsa el "claro" botón notificatios de la barra de notificaciones?
Eche un vistazo a la barra de notificaciones de la aplicación "Yahoo".
que han pasado por este artículo SDK: http://developer.android.com/guide/topics/ui/notifiers/notifications.html#Updating, pero no pudo averiguar.
¿Estás seguro de que mantener esta notificación estable es una buena idea? –
@Heiko Rupp siento decir que sí, pero es el requisito real que tengo que implementar. –
Los lectores deben ser claros en esto: usar esto para publicitar su aplicación molestará a sus usuarios intensamente y solo se debe utilizar para que necesite proporcionar un acceso rápido constante para controlar un servicio en funcionamiento. Por ejemplo: una aplicación de música (solo mientras se está reproduciendo algo), navegación (solo mientras navega por una ruta) o registrador de GPS (mientras se está registrando). –