Skip to content

Instantly share code, notes, and snippets.

@ditn
Last active April 26, 2018 11:02
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ditn/fcb2fb29fcdee6d4a6a698dadd24ac34 to your computer and use it in GitHub Desktop.
builder pattern in kotlin with breakout
val builder = NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID)
.setSmallIcon(icon)
// Excluded for brevity
.setContentText(text)
if (AndroidUtils.is19orHigher()) {
builder.setVibrate(longArrayOf(100))
} else {
builder.setVibrate(longArrayOf())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment