Skip to content

Instantly share code, notes, and snippets.

@AliAsadi
Last active October 12, 2018 17:15
Show Gist options
  • Save AliAsadi/f3031d854356b8a0e595e9ef7a68a379 to your computer and use it in GitHub Desktop.
Save AliAsadi/f3031d854356b8a0e595e9ef7a68a379 to your computer and use it in GitHub Desktop.
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, "Default", NotificationManager.IMPORTANCE_DEFAULT);
channel.setVibrationPattern(new long[0]);
channel.enableVibration(false);
channel.setSound(null,null);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (notificationManager != null) {
notificationManager.createNotificationChannel(channel);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment