Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
android.app.NotificationManager notificationManager = (android.app.NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
NotificationChannel channelMessage = new NotificationChannel("channel_id", "channel_name", android.app.NotificationManager.IMPORTANCE_DEFAULT);
channelMessage.setDescription("channel description");
channelMessage.enableLights(true);
channelMessage.setLightColor(Color.GREEN);
channelMessage.enableVibration(true);
channelMessage.setVibrationPattern(new long[]{100, 200, 100, 200});
channelMessage.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
notificationManager.createNotificationChannel(channelMessage);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment