Skip to content

Conversation

@yeran27
Copy link

@yeran27 yeran27 commented Nov 23, 2025

No description provided.

Copy link
Collaborator

@KYM-P KYM-P left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GOOD 기능 부분에 부족함은 없습니다.

ActivityCompat.requestPermissions(
this, arrayOf(mediaPermission), 1000
)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 if 문이
if (ContextCompat.checkSelfPermission(this, mediaPermission) != PackageManager.PERMISSION_GRANTED)
안에 있으면 안됩니다.

이유는 mediaPermission 이 거절 되어있을 경우에만 POST_NOTIFICATIONS 검사를 하게 됩니다.
그러니 media 권한은 있는데 notification 권한이 없어도 정상 작동하게 됩니다.

mediaPlayer?.release()
onClick(music)

mediaPlayer = MediaPlayer().apply {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앞에서 onClick(music) 을 통해 music 을 실행하고 있습니다.

여기서 한번 더 MediaPlayer 를 만들고 start() 를 한다면
노래가 2번 실행됩니다.
삭제되어야 하는게 맞습니다.

"ACTION_PLAY" -> {
val title = intent.getStringExtra("MUSIC_TITLE")?: ""
val artist = intent.getStringExtra("MUSIC_ARTIST")?: ""
val uriString = intent.getStringExtra("MUSIC_URI")?: ""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MUSIC_TITLE, MUSIC_ARTIST, MUSIC_URI 는 상수 관리를 한다면 좋을 거 같습니다.


override fun onStartCommand(intent: Intent?, flags: Int, startID: Int): Int{
when (intent?.action) {
"ACTION_PLAY" -> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런 부분도 상수 관리가 좋겠네요.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants