2
In my app when activity goes to the state onPause I trigger her notifications via Notifitionmanager.
I wish she could be restored to the state onResume if a click in the notification.
Through this code I can open a new activity, but what I wanted was to recover the activity that is in the state onPause:
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
PendingIntent p = PendingIntent.getActivity(MainActivity.this, 0, new Intent(MainActivity.this, MainActivity.class), 0);
NotificationCompat.Builder builder = new NotificationCompat.Builder(MainActivity.this);
builder.setTicker("Tiker Valor: "+Integer.toString(i));
builder.setContentTitle("Titulo Valor: "+Integer.toString(i));
builder.setContentText("Descrição");
builder.setSmallIcon(R.drawable.ic_launcher);
builder.setContentIntent(p);
Notification n = builder.build();
n.flags = Notification.FLAG_AUTO_CANCEL;// Retira a notificação quando esta for clicada
nm.notify(R.drawable.ic_launcher, n);
ramaral, it worked. Thank you. Hug.
– Vitor Mendanha