Hello,
I'm trying to launch the application when the user taps a local notification. To accomplish this, we need to set the ContentIntent to the notification, and that start's the desired activity set at the intent.
Here's some code:
Intent mainActivityIntent = new Intent(context, typeof(MainActivity)); PendingIntent mainActivityPendingIntent = PendingIntent.GetActivity(context, 0, mainActivityIntent, PendingIntentFlags.NoCreate); Notification.Builder builder = new Notification.Builder(context) .SetContentTitle("Atenção").SetContentText(texto) .SetSmallIcon(Resource.Drawable.icon); Notification notification = builder.Build(); notification.ContentIntent = mainActivityPendingIntent;
The problem is, when the user taps, if the application is already loaded, a new instance of the application is created. I tried to re-use an instance of the Application but the same problem happens.
Could somebody help me?