I have a music stream app and I want to display a foreground notification when the music is streaming. I'm doing the streaming in a seperate service and the code I use for the foreground notification is the following:
Notification notification = new Notification(R.drawable.ic_stat_notification, getString(R.string.app_name), System.currentTimeMillis());
Intent notificationIntent = new Intent(this, PlayerActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(this,getString(R.string.app_name),
getString(R.string.streaming), pendingIntent);
startForeground(4711, notification);
The symbol is shown in the taskbar, and if i click on the notification the app opens up, but it is a total new activity (i guess because of creating a new Intent). So if I have e.g. a dialog open in the app it isn't open if I dismiss the app (clicking home) and then slinding/clickling the app icon in the notification bar. How can I handle this so that the "old/real" activity is shown?