He estado trabajando en las notificaciones push y puedo implementarlo y mostrarlo en la barra de estado, el problema al que me enfrento es que quiero mostrarlo incluso si el teléfono está bloqueado , Debajo de la pantalla de bloqueo donde dice ("arrastrar para desbloquear"), he visto notificaciones como esa, pero no puedo encontrar ningún ejemplo para eso.Android cómo mostrar la notificación en la pantalla
Ejemplo: Al igual que cuando recibió una llamada perdida, se mostrará debajo del botón de bloqueo en la pantalla.
Código:
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
int icon = R.drawable.icon_launcher;
CharSequence tickerText = "MyApplication";
long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, when);
notification.defaults |= Notification.DEFAULT_SOUND|Notification.DEFAULT_VIBRATE|Notification.DEFAULT_LIGHTS;;
CharSequence contentTitle = this.title;
CharSequence contentText = this.message;
Intent notificationIntent = new Intent(this, MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
mNotificationManager.notify(NOTICE_ID, notification);
sin relación, que no necesariamente tienen que guardar todo como variables locales – CrackerJack9
Esto no es posible en este momento. –
@Copa ¿qué quieres decir? ¿Cuál es tu referencia?Tengo varias aplicaciones que muestran notificaciones de la manera que describe el OP (barra de notificaciones, mientras la pantalla está bloqueada). – CrackerJack9