Last active
August 11, 2017 22:03
-
-
Save nazmulidris/2404a2f2108f4cdbfa81d84aa6799257 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final String CHANNEL_ID = "media_playback_channel"; | |
@RequiresApi(Build.VERSION_CODES.O) | |
private void createChannel() { | |
NotificationManager | |
mNotificationManager = | |
(NotificationManager) mContext | |
.getSystemService(Context.NOTIFICATION_SERVICE); | |
// The id of the channel. | |
String id = CHANNEL_ID; | |
// The user-visible name of the channel. | |
CharSequence name = "Media playback"; | |
// The user-visible description of the channel. | |
String description = "Media playback controls"; | |
int importance = NotificationManager.IMPORTANCE_LOW; | |
NotificationChannel mChannel = new NotificationChannel(id, name, importance); | |
// Configure the notification channel. | |
mChannel.setDescription(description); | |
mChannel.setShowBadge(false); | |
mChannel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC); | |
mNotificationManager.createNotificationChannel(mChannel); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment