Search code examples
androidandroid-studionotificationspreview

Android O preview Notification Channels


This is my first time using the Android Studio Preview, I need to show the notification count on my application icon so I am using it since this functionality is part of the Android O preview. My question is how can I ensure compatibility since my current target is 25.0, will this show for the previous versions and current one ? or should I just use some other method to show this notification functionnality ?


Solution

  • It has been a month since this question has been asked.but i just write this answer if anyone faces this issue.

    As said by Android documentation:

    If you target Android O and post a notification without specifying a valid notifications channel, the notification fails to post and the system logs an error.

    There is an easy example how to create Notification Channels here:

    https://developer.android.com/preview/features/notification-channels.html

    And about the question:

    Android O introduces notification channels to provide a unified system to help users manage notifications. When you target Android O, you must implement one or more notification channels to display notifications to your users. If you don't target Android O, your apps behave the same as they do on Android 7.0 when running on Android O devices.

    So defined channels won't have any affect on Api < 26