Programación y Desarrollo para Android Subforo exclusivo para temas de programación de software para PDAs y desarrollo de aplicaciones, interfaces, etc bajo Android

Respuesta
 
Herramientas
  #1  
Viejo 11/03/15, 19:22:29
Array

[xs_avatar]
MorSerNa MorSerNa no está en línea
Miembro del foro
 
Fecha de registro: feb 2015
Mensajes: 478
Modelo de smartphone: Huawei G510
Tu operador: Yoigo
Crear notificación al estilo Lollipop

Buenas pues tengo una app que me notifica, al tipo Whatsapp, pero estas notificiaciones son las de siempre, y me gustaria aprovechar que tengo en el movil Lollipop, para poder poner las notificaciones a su estilo :P

TIPO ASI
(Click para mostrar/ocultar)
__________________
BetaTester
Actualmente, SlimpLP+
Responder Con Cita


  #2  
Viejo 11/03/15, 20:20:44
Array

[xs_avatar]
kriogeN kriogeN no está en línea
Colaborador/a
· Votos compra/venta: (1)
 
Fecha de registro: oct 2010
Localización: Murcia
Mensajes: 4,637
Modelo de smartphone: Samsung Galaxy S7 Edge SM-G935F
Tu operador: Vodafone
Si usas el NotificationCompat actualizado a la última versión (con la v21 es suficiente) te salen al estilo Lollipop si tienes Lollipop. De lo contrario tendrás que poner como Target a Lollipop, y es muy probable que la notificación falle en móviles con versiones anteriores.

Además debes usar PRIORITY_HIGH, si no el "heads up" no sale.
Responder Con Cita
  #3  
Viejo 11/03/15, 21:26:23
Array

[xs_avatar]
MorSerNa MorSerNa no está en línea
Miembro del foro
 
Fecha de registro: feb 2015
Mensajes: 478
Modelo de smartphone: Huawei G510
Tu operador: Yoigo
A vale, gracias

Una cosa, por que cuando el móvil esta bloqueado no me llega las notificaciónes de mi app y cuando lo desbloqueo llegan todas a la vez?
__________________
BetaTester
Actualmente, SlimpLP+
Responder Con Cita
  #4  
Viejo 24/03/15, 11:49:47
Array

[xs_avatar]
MorSerNa MorSerNa no está en línea
Miembro del foro
 
Fecha de registro: feb 2015
Mensajes: 478
Modelo de smartphone: Huawei G510
Tu operador: Yoigo
Me sigue sin salir la notificación te dejo el codigo para que le veas plss :
(Click para mostrar/ocultar)

final NotificationCompat.Builder notificacion = new NotificationCompat.Builder(SocketServicio.this);
notificacion.setSmallIcon(R.mipmap.ic_launcher);
notificacion.setTicker("Temperatura alta de "+codigo1); // Mensaje cuando aparece
notificacion.setWhen(System.currentTimeMillis()); // Hora que mostramos en la notificacion
notificacion.setContentTitle("¡Temperatura alta!");
notificacion.setContentText(codigo1);
notificacion.setContentInfo(""); // Informacion breve-extra
notificacion.setPriority(Notification.PRIORITY_HIG H);
PendingIntent myPendingIntent;
Intent myIntent = new Intent();
Context myContext = getApplicationContext(); // Actual Activity
myIntent.setClass(myContext, MainActivity.class); // Intent para invocar luego el Activity
myIntent.putExtra("ID", 1); // Mismo ID que la notificacion para luego borrar la notificacion de la barra superior
myPendingIntent = PendingIntent.getActivity(myContext, 0, myIntent, 0); // Intent pendiente de invocar
notificacion.setContentIntent(myPendingIntent);
//ENSEÑAMOS NOTIFICACION
Notification n = notificacion.build();
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
nm.notify(1, n);
__________________
BetaTester
Actualmente, SlimpLP+
Responder Con Cita
Respuesta

Estás aquí
Regresar   Portal | Indice > Todo sobre Android > Programación y Desarrollo para Android



Hora actual: 14:47:06 (GMT +2)



User Alert System provided by Advanced User Tagging (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.

Contactar por correo / Contact by mail / 邮件联系 /