안녕하세요.
라라제이입니다:)
오늘은 본업인..
모바일 개발을 포스팅하려합니다.
노티피케이션(Notification)의 Title이나 Conents에
이모지(Emoji, 이모티콘) 등을 넣어
멋지게 내용을 채우고 싶지만
자주 사용하지는 않아서
찾아보게 되는 코드입니다.
우선 결과 화면입니다.
Java 소스입니다.
public NotificationCompat.Builder getChannelNotification()
{
...
return new NotificationCompat.Builder(getApplicationContext(),cID)
.setContentTitle("잊지마세요!")
.setContentText("공부할 시간입니다 "+new String(Character.toChars(0x1F609)) )
.setSmallIcon(R.drawable.ic_stat)
.setContentIntent(resultPendingIntent);
}
그리고 Kotlin입니다.
// Create an Intent for the activity you want to start
val channelNotification: NotificationCompat.Builder
get() {
...
return NotificationCompat.Builder(applicationContext, cID)
.setContentTitle("잊지마세요!")
.setContentText("공부할 시간입니다 " + String(Character.toChars(0x1F609)))
.setSmallIcon(R.drawable.ic_stat)
.setContentIntent(resultPendingIntent)
}
이렇게 Character.toChars(유니코드)를 넣으면 됩니다.
이모지들은 아래 링크에서
원하는 이모지를 찾아보면 유니코드도 있습니다.
http://unicode.org/emoji/charts/emoji-list.html
😀 → 이건 U+1F600인데요.
그럼 Character.toChars(0x1F600)
이렇게 넣어서 사용하세요 😉
간단한 개발 포스팅이었습니다.
오늘도 좋은하루되세요.!
'Tech > Android iOS 개발' 카테고리의 다른 글
조치 필요: 앱이 Google Play 정책을 준수하지 않음 - 데이터 보안 섹션 문제 해결 (1) | 2022.07.19 |
---|