我想要做的是一项活动,该活动从抽屉流式传输音乐,而不是刷新,因为这会使同一首音乐播放两次。
// 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);