Foros del Web » Programando para Internet » Android »

Barra de Estado - Notificaciones y que vuelva a la actividad

Estas en el tema de Barra de Estado - Notificaciones y que vuelva a la actividad en el foro de Android en Foros del Web. Hola! como estan? Una consulta mas bien tecnica... Tengo una app con un mplayer funcionando. Lo que quiero es que cuando se quiera minimizar la ...
  #1 (permalink)  
Antiguo 22/11/2012, 20:20
 
Fecha de Ingreso: julio-2008
Ubicación: Buenos Aires, Mar del plata
Mensajes: 250
Antigüedad: 15 años, 9 meses
Puntos: 2
Barra de Estado - Notificaciones y que vuelva a la actividad

Hola! como estan?

Una consulta mas bien tecnica...
Tengo una app con un mplayer funcionando. Lo que quiero es que cuando se quiera minimizar la app (boton home) quede funcionando como hasta ahora pero con una notificación en el status bar.
Como no puedo manejar el home con el keyEvent, pensé en los estados de las actividades.
Seria un onPause? u onStop?

Lo que quiero despues es que clickeando la notificación me vuelva a la misma actividad. Como hago para que sea la misma? con onResume?


Código ANDROID:
Ver original
  1. @Override
  2.         protected void onPause() {
  3.             // TODO Auto-generated method stub
  4.             super.onPause();
  5.             try {
  6.                    notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
  7.                    myNotification = new Notification(R.drawable.icon,"mActivity",System.currentTimeMillis());
  8.                    Context context = getApplicationContext();
  9.                    String notificationTitle = "mActivity";
  10.                    String notificationText = "El estado de la app está acá";
  11.                    Intent myIntent = new Intent(this, MActivity.class);
  12.                    //PendingIntent pendingIntent = PendingIntent.getActivity(MActivity.this, 0, myIntent,Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY);
  13.                    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, myIntent,0);
  14.                    //myNotification.defaults |= Notification.DEFAULT_SOUND;
  15.                    myNotification.flags |= Notification.FLAG_AUTO_CANCEL;
  16.                    myNotification.setLatestEventInfo(context, notificationTitle, notificationText, pendingIntent);
  17.                    notificationManager.notify(MY_NOTIFICATION_ID, myNotification);
  18.  
  19.             } catch (Exception e) {
  20.             }
  21.         }

Muchas gracias!!!!!!!!

Etiquetas: estados, notificaciones, notification, onpause, onstop
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:49.