• 카테고리

    질문 & 답변
  • 세부 분야

    모바일 앱 개발

  • 해결 여부

    미해결

24강에서 setIcon과 MessagingStyle질문드립니다.

23.02.16 04:41 작성 조회수 255

0

강사님 24강 자료 그대로 복사해서 가져온 것입니다!

button.setOnClickListener { if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P){ val builder1 = getNotificationBuilder("message", "message style") builder1.setContentTitle("Message Style") builder1.setContentText("Message Style Notification") builder1.setSmallIcon(android.R.drawable.ic_input_delete) val personBuilder1 = Person.Builder() val icon1 = IconCompat.createWithResource(this, android.R.drawable.ic_media_next) personBuilder1.setIcon(icon1) personBuilder1.setName("홍길동") val person1 = personBuilder1.build() val personBuilder2 = Person.Builder() val icon2 = IconCompat.createWithResource(this, R.mipmap.ic_launcher) personBuilder2.setIcon(icon2) personBuilder2.setName("최길동") val person2 = personBuilder2.build() val messageStyle = NotificationCompat.MessagingStyle(person1) messageStyle.addMessage("첫 번째 메시지", System.currentTimeMillis(), person1) messageStyle.addMessage("두 번째 메시지", System.currentTimeMillis(), person2) messageStyle.addMessage("셋 번째 메시지", System.currentTimeMillis(), person1) messageStyle.addMessage("네 번째 메시지", System.currentTimeMillis(), person2) builder1.setStyle(messageStyle) val notification = builder1.build() val manager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager manager.notify(10, notification) } }

에서

personBuilder1.setIcon(icon1)

personBuilder2.setIcon(icon2)

부분에서 icon1,icon2 부분에서 Type mismatch: inferred type is IconCompat! but Icon? was expected 오류가 나오고

val messageStyle = NotificationCompat.MessagingStyle(person1)

부분에서는 None of the following functions can be called with the arguments supplied가 나옵니다 ㅠㅠ 어떤 부분이 문제인지 알 수 있을까요 ㅠㅠ

답변 1

답변을 작성해보세요.

0

일단 해당 오류는 발생하지 않는 것으로 확인되었습니다. 허나 지금 버전에서 이 노티피케이션이 나타나지 않는 것을 확인 하엿습니다. 원인은 파악중에 있습니다. 일단 Message Notification은 건너 띄시고 다음 강의를 들어주시기 바랍니다. 감사합니다.

감사합니다.

테슬라 리퍼럴 코드 : http://ts.la/raputa71825