-
Notifications
You must be signed in to change notification settings - Fork 1
[김예란_Android] 5주차 과제 제출 #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
KYM-P
left a comment
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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")?: "" |
There was a problem hiding this comment.
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" -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이런 부분도 상수 관리가 좋겠네요.
No description provided.