0
I’m having trouble calling an Activit via Notification, every time I press the notification Activity is loaded from scratch, losing the data that was in the one that was open.
NotificationManagerCompat nm = NotificationManagerCompat.from(context);
Intent it = new Intent(context, MapsActivity.class);
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(context)
.setDefaults(Notification.DEFAULT_ALL)
.setAutoCancel(true)
.setContentIntent(PendingIntent.getActivity(context, 0, it, PendingIntent.FLAG_UPDATE_CURRENT))
.setSmallIcon(R.mipmap.ic_usuario)
.setContentTitle("Aplicativo")
.setContentText(msg)
.setAutoCancel(true).setDefaults(2).setDefaults(1)
.setSound(RingtoneManager.getDefaultUri(2), 3);
nm.notify(1, mBuilder.build());
I just want the notification to call the Activity that is open, vlw!
Settled with the
android:launchMode="singleTask"
vlw!– Rubens Ventura