Open
Conversation
KYM-P
reviewed
Nov 24, 2025
| ActivityCompat.requestPermissions( | ||
| this, arrayOf(mediaPermission), 1000 | ||
| ) | ||
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { |
Collaborator
There was a problem hiding this comment.
이 if 문이
if (ContextCompat.checkSelfPermission(this, mediaPermission) != PackageManager.PERMISSION_GRANTED)
안에 있으면 안됩니다.
이유는 mediaPermission 이 거절 되어있을 경우에만 POST_NOTIFICATIONS 검사를 하게 됩니다.
그러니 media 권한은 있는데 notification 권한이 없어도 정상 작동하게 됩니다.
| mediaPlayer?.release() | ||
| onClick(music) | ||
|
|
||
| mediaPlayer = MediaPlayer().apply { |
Collaborator
There was a problem hiding this comment.
앞에서 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")?: "" |
Collaborator
There was a problem hiding this comment.
MUSIC_TITLE, MUSIC_ARTIST, MUSIC_URI 는 상수 관리를 한다면 좋을 거 같습니다.
|
|
||
| override fun onStartCommand(intent: Intent?, flags: Int, startID: Int): Int{ | ||
| when (intent?.action) { | ||
| "ACTION_PLAY" -> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.