Oreo 이상의 OS에서 Notification이 발생하지 않는 문제

2019. 2. 14. 14:42Programming/Android

반응형

>Developer warning for package "com.your.app" Failed to post notification on channel "null" See log for more details


Notification이 발생하지 않아서 원인을 추적하던 중, Notification이 발생해야 할 시점에 Logcat을 확인하니 위와같은 에러가 찍혔다. 테스트용 스마트폰을 LG G5, Samsung Galaxy FE, Samsung Galaxy 7을 구비해놓고 테스트했는데, Samsung폰에서만 증상이 발생해서 제조사에 따른 문제인가 싶었다. 확인해보니 Android 8.0 부터 추가된, notification channels과 관련된 내용이었다. LG G5에서 증상이 발생하지 않은 건, 단순히 업데이트가 끊겨서...


Android 버전에 따라 `NotificationChannel` 객체를 생성하고, 해당 객체를 `NotificationManager.createNotificationChannel()`로 전달하여 채널을 생성하는 코드는 Android Developers의 Create a notification channel에 잘 설명되어있다. [Create a notification channel, Android Developers](https://developer.android.com/training/notify-user/channels#kotlin) 페이지를 참조하도록 하자.


-----

[Create a notification channel, Android Developers](https://developer.android.com/training/notify-user/channels#kotlin)

[NotificationChannel, Android developers](https://developer.android.com/reference/android/app/NotificationChannel)

[8.0 오레오 알림채널(Notification Channel) 대응하기, 박상권 님](https://gun0912.tistory.com/77)

[NotificationChannel issue in Android O, StackOverflow](https://stackoverflow.com/questions/45668079/notificationchannel-issue-in-android-o)

[Android O reporting notification not posted to channel - but it is, StackOverflow](https://stackoverflow.com/questions/44489657/android-o-reporting-notification-not-posted-to-channel-but-it-is)

반응형