Last active
August 28, 2019 11:14
-
-
Save GitEliteNovice/fdaa79c9bb91070d97a4a16b324fb5ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val pendingIntent: PendingIntent = | |
Intent(this, ExampleActivity::class.java).let { notificationIntent -> | |
PendingIntent.getActivity(this, 0, notificationIntent, 0) | |
} | |
val notification: Notification = Notification.Builder(this, CHANNEL_DEFAULT_IMPORTANCE) | |
.setContentTitle(getText(R.string.notification_title)) | |
.setContentText(getText(R.string.notification_message)) | |
.setSmallIcon(R.drawable.icon) | |
.setContentIntent(pendingIntent) | |
.setTicker(getText(R.string.ticker_text)) | |
.build() | |
startForeground(ONGOING_NOTIFICATION_ID, notification) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment