Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ParkSangGwon
Created February 4, 2018 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ParkSangGwon/5158c03ea6b920e7e312bbc559bd053b to your computer and use it in GitHub Desktop.
Save ParkSangGwon/5158c03ea6b920e7e312bbc559bd053b to your computer and use it in GitHub Desktop.
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