Skip to content

Instantly share code, notes, and snippets.

@ditn
Last active April 26, 2018 11:02
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