0

What im looking to do is have an activity that streams music resume from Drawer rather than refresh as that results in the same music playing twice.

        // Create an Intent for the activity you want to start
        Intent resultIntent = new Intent(this, SoundCloudActivity.class);
        // Create the TaskStackBuilder and add the intent, which inflates the back stack
        TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
        stackBuilder.addNextIntentWithParentStack(resultIntent);
        // Get the PendingIntent containing the entire back stack
        PendingIntent resultPendingIntent =
                stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);

NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(SoundCloudActivity.this, CHANNEL_ID)
                .setSmallIcon(R.drawable.video_icon_48)
                .setContentTitle("Music")
                .setContentText("Streaming....")
                .setColor(Color.parseColor("#009add"))
                .setAutoCancel(true)
                .setContentIntent(resultPendingIntent);
user237462
  • 387
  • 1
  • 5
  • 24
  • [Resume application and stack from notification](https://stackoverflow.com/questions/5502427/resume-application-and-stack-from-notification) – RonTLV Aug 13 '18 at 15:54
  • Try the following solution as provided by @rekaszeru https://stackoverflow.com/questions/2386542/resuming-an-activity-from-a-notification?rq=1 – Xixis Aug 13 '18 at 15:58

0 Answers0