Android MediaPlayer的通知

Android MediaPlayer的通知,android,notifications,android-mediaplayer,Android,Notifications,Android Mediaplayer,我是Android新手,目前正在开发一款用于在线流媒体的MediaPlayer。mediaplayer运行正常,但我在通知方面遇到了问题。当我按“播放”时,通知将显示在通知栏中,当我单击通知栏中的通知时,它将启动一个新活动,而不是显示当前活动。 我不知道是否对此应用程序的PendingEvent使用了错误的标志 我的代码如下所示: public void Notification_Inicialization() { Intent intent = new Intent(this,radio_a

我是Android新手,目前正在开发一款用于在线流媒体的MediaPlayer。mediaplayer运行正常,但我在通知方面遇到了问题。当我按“播放”时,通知将显示在通知栏中,当我单击通知栏中的通知时,它将启动一个新活动,而不是显示当前活动。 我不知道是否对此应用程序的PendingEvent使用了错误的标志

我的代码如下所示:

public void Notification_Inicialization()
{
Intent intent = new Intent(this,radio_app_3.class);


PendingIntent pendingIntent = PendingIntent.getActivity(this,0,intent,PendingIntent.FLAG_UPDATE_CURRENT);
res = getApplicationContext().getResources();

app_notification = new Notification.Builder(this).setTicker(tickerTitle).setContentTitle(title)
.setSmallIcon(R.drawable.android_icon).setLargeIcon(BitmapFactory.decodeResource(res, R.drawable.ic_launcher))
.setContentIntent(pendingIntent).addAction(R.drawable.android_icon,"Play",pendingIntent)
.getNotification();

notification_layout = new RemoteViews(getPackageName(),R.layout.activity_radio_app_3);

notification_layout.setTextViewText(R.id.button_play,getString(R.string.app_name));

notification_layout.setOnClickPendingIntent(R.id.button_play,pendingIntent);

app_notification.flags = Notification.FLAG_ONGOING_EVENT;

NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);

notificationManager.notify(uniqueID,app_notification);

}
希望有人能帮我解决这个问题
提前感谢

您能粘贴包含该活动声明的清单片段吗?谢谢您的回复。我通过将mediaplayer活动声明为“SingleTask”来解决这个问题。