I have a background service which is running and I am using a notification and a PendingIntent to allow the user to "reopen" the existing home activiy. Unfortunately what's happening is that it's creating a new home activity stacked on top of the one I want to go to meaning that the user has to hit the back button to get back to the original one. What do I have to change in the following service code to ensure it simply reopens the existing Activity?
Intent notificationIntent = new Intent(ApplicationContext, typeof( MainActivity ) );
notificationIntent.SetFlags (ActivityFlags.NewTask);
PendingIntent pendingIntent = PendingIntent.GetActivity(this, 0, notificationIntent, 0 );
Notification notification = new Notification (Resource.Drawable.Icon, "Playing: " + mStreamName );
notification.Flags |= NotificationFlags.OngoingEvent;
notification.SetLatestEventInfo (this, "MyApp", "Announcement!", pendingIntent);
StartForeground((int)NotificationFlags.ForegroundService, notification);
My manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="..." android:versionCode="2" android:versionName="2.0">
<uses-sdk />
<application android:label="..." android:icon="@drawable/icon">
<service android:enabled="true" android:name=".AudioService"/>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>