Skip to content

Instantly share code, notes, and snippets.

@hitherejoe
Created March 22, 2017 12:44
Show Gist options
  • Save hitherejoe/1ad7db575a0255e3d77753ef9999dcbf to your computer and use it in GitHub Desktop.
Save hitherejoe/1ad7db575a0255e3d77753ef9999dcbf to your computer and use it in GitHub Desktop.
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
String channelId = "some_channel_id";
CharSequence channelName = "Some Channel";
int importance = NotificationManager.IMPORTANCE_LOW;
NotificationChannel notificationChannel = new NotificationChannel(channelId, channelName, importance);
notificationChannel.enableLights(true);
notificationChannel.setLightColor(Color.RED);
notificationChannel.enableVibration(true);
notificationChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400});
notificationManager.createNotificationChannel(notificationChannel);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment