0
음악 플레이어를 개발 중입니다. 생성 된 알림을 클릭하면 현재 재생중인 노래와 검색 바를 표시하는 것이 아니라이 활동의 새 버전이 표시됩니다.알림을 클릭 할 때 동일한 활동을 어떻게 표시합니까?
나는 통지를 사용하고 현재 코드는 당신이 당신의 활동에 선언되는 모드를 시작
Intent i = new Intent(this, AmplitudeMusicPlayer.class);
i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pIntent = PendingIntent.getActivity(this, 0 , i, 0);
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
NotificationCompat.Builder noti = new NotificationCompat.Builder(this);
noti.setContentTitle("Now Playing")
.setContentText(songTitle)
.setSmallIcon(R.drawable.default_art)
.setContentIntent(pIntent);
notificationManager.notify(0, noti.build());
고맙습니다! 올바른 것으로 표시 – user2047366