일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- lifecycle
- activity
- View
- onLayout
- kotlin
- Coroutine
- 알림
- Algorithm
- AppBarLayout
- onMeasure
- notification
- ViewModel
- 안드로이드
- CollapsingToolbarLayout
- hilt
- CustomView
- Android
- HTTP
- recyclerview
- DataBinding
- Navigation
- LiveData
- 백준
- room
- 알고리즘
- 코틀린
- CoordinatorLayout
- sqlite
- BOJ
- Behavior
- Today
- Total
목록Android (안드로이드)/Notification (5)
개발일지
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/cLZSNJ/btq9DUcV8gv/MSMxMkuJW3DsjKZg9rUKE0/img.png)
Notification Custom 사용자가 직접 Layout을 구성하여 RemoteView를 통해 Nofitication 템플릿을 만들 수 있습니다. * 보통 축소된 Notification은 64dp, 확장된 Notification은 256dp로 제한됩니다. RemoteViews를 만들고setCustomContentView를 통해 적용할 수 있다. * 확장된 CustomContentView는 setCustomBigContentView를 통해 적용할 수 있다. private fun createCustomContentView(): RemoteViews { return RemoteViews(context.packageName, R.layout.notification_content_view).apply { s..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/y1xq7/btq9IE1plDg/ofp5jxLjxhaSkSBtZIgRM0/img.png)
그룹 Android 7.0(API 24)부터는 관련된 알림을 그룹으로 표시할 수 있습니다. 예를 들어, 앱에서 수신된 이메일의 알림을 표시하려면 모든 알림을 동일한 그룹에 포함하여 함께 축소할 수 있도록 해야 합니다. Android에서 기본적으로 그룹을 지정하지 않은 경우 4개 이상의 알림을 자동으로 그룹화 합니다. Notification 만들기 Notification을 만들 때 setGroup을 통해 그룹을 정해줍니다. val notification = NotificationCompat.Builder(context, CHANNEL_ID) .setSmallIcon(R.drawable.ic_android) .setContentTitle(message.title) .setContentText(message...
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/l1duH/btq9CuTjdWR/n8t7INEO0obTPBgYv8ugLK/img.png)
확장형 알림 기존의 알림보다 훨씬 많은 알림을 제공하기 위해 확장형 알림을 사용할 수 있다. 코드 @Singleton class ExtendNotificationManager @Inject constructor( @ApplicationContext private val context: Context ) { companion object { private const val CHANNEL_ID_IMPORTANCE_HIGH = "com.taetae98.notification.EXTEND.IMPORTANCE_HIGH" private const val CHANNEL_ID_IMPORTANCE_LOW = "com.taetae98.notification.EXTEND.IMPORTANCE_LOW" private const..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/cEvOLU/btq9GtTwb7W/8oLAIiXcVKB8djARkxfbyk/img.png)
Notification Action 알림을 빠르게 대응할 수 있도록 알림을 탭했을 때 작업을 추가 하거나 최대 3개의 Action을 추가할 수 있다. setContentIntent 알림을 탭 했을 때 PendingIntent를 통해 작업을 정할 수 있다. private fun createPendingIntent(message: Message): PendingIntent { return NavDeepLinkBuilder(context) .setGraph(R.navigation.navigation_main) .setDestination(R.id.actionFragment) .setArguments( Bundle().apply { putSerializable("message", message) } ) .cre..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/t1DS4/btq9C92DSBK/KjsmXIWMKQCQ7XhfXj2ZI0/img.png)
Notification 사용자에게 알림을 보내야할 때 사용한다. 앱 또는 사용자가 닫을 때까지 알림창에 표시된다. Head Up Notification 처럼 즉각적으로 알림을 보여줄 수 있다. (Android 5.0(API 21) 이상 가능) Lock Screen에 표시할 수 있고, 보여주는 내용을 지정할 수 있다. (Android 5.0(API 21) 이상 가능) Launcher에서 지원하는 경우 알림 뱃지를 설정할 수 있다. (Android 8.0(API 26) 이상 가능) Notification 구성 Small Icon : 필수 구성요소이며 setSmallIcon을 통해 설정할 수 있다. App Name : 앱 이름, 시스템에서 제공한다. Time : 시스템에서 제공하지만 setWhen으로 설정하거..