i make an app with tales and some of the tham will have text and audio. ol navigation i make in fragments, so at first - fragment with listView with taleNames, when some chosen - next fragment in which i will upload text and audio for chosen tale. for audio i am using Service, and also there i push notification when audioTales started.
my problem is next: when i startService and audio begin to play, i am hide from my app to main screen and than click on notification in toolBar. i need that notification push me to my current fragment where audio Tale is playing now, but in fact it push me to ListView.
here is my notification:
    private void initNotification(){
            CharSequence tikerText = getResources().getString(R.string.tickerText);
            NotificationManager mNotificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
            Notification notification = new Notification(R.drawable.ic_launcher,tikerText,System.currentTimeMillis());
            notification.flags = Notification.FLAG_ONGOING_EVENT;
            Context context = getApplicationContext();
            CharSequence contentTitle = getResources().getString(R.string.contentTitle);
            CharSequence contentText = getResources().getString(R.string.contentText);
            Intent notifIntent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
            notifIntent.putExtra("showAudioFrag",true);
            PendingIntent contentIntent = PendingIntent.getActivity(context,0,notifIntent,0);
            notification.setLatestEventInfo(context,contentTitle,contentText,contentIntent);
            mNotificationManager.notify(NOTIFICATION_ID,notification);
        }
next code iam added in MainActivity in OnCreate:
intent = getIntent();
        boolean reloadFragmentFromNotification = intent.getBooleanExtra("showAudioFrag",false);
        if (reloadFragmentFromNotification){
            Fragment fragment = new TaleActivity_Audio();
            FragmentManager fragmentManager = getSupportFragmentManager();
            fragmentManager.beginTransaction()
                    .replace(R.id.container,fragment)
                    .commit();
        } else {
            mNavigationDrawerFragment = (NavigationDrawerFragment)
                    getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
            mTitle = getTitle();
            // Set up the drawer.
            mNavigationDrawerFragment.setUp(
                    R.id.navigation_drawer,
                    (DrawerLayout) findViewById(R.id.drawer_layout));
        }
if needed full project on gitHub: https://github.com/radric/Tales_updated.git