タイトルが説明的ではないことは承知していますが、説明させてください。私は Shoutcast ストリーミング ラジオ プロジェクトに取り組んでいます。アプリがストリーミングを開始すると、通知バーにラジオの名前と現在の曲 ID を含む通知が表示されます。これまでのところ、すべて正常に見えますが、ユーザーが通知に触れると (ストリームの継続中に)、アプリが再び開き、別のストリームの再生が開始されます。問題をよく説明できたことを願っています。コードは次のとおりです。
編集:
Hey again, I have just figured out how to make it that way and here is the sample code.
String ns = Context.NOTIFICATION_SERVICE;
mNotificationManager = (NotificationManager) getSystemService(ns);
icon = R.drawable.rbnot;
CharSequence tickerText = "Radyo Bilkent";
long when = System.currentTimeMillis();
notification = new Notification(icon, tickerText, when);
notification.flags = Notification.FLAG_ONGOING_EVENT | Notification.FLAG_NO_CLEAR;
Intent notificationIntent = new Intent(this, myMain.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
Context context = getApplicationContext();
CharSequence contentTitle = "Radyo Bilkent";
CharSequence contentText = currPlayView.getText();
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
mNotificationManager.notify(HELLO_ID, notification);