Created
January 19, 2017 22:01
-
-
Save brendan-fahy/e1730c75cb6525287bf6389383b40c6a to your computer and use it in GitHub Desktop.
This file contains 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
private fun buildNotification(batteryStatus: Intent): Notification { | |
val level = batteryStatus.getIntExtra(BatteryManager.EXTRA_LEVEL, -1) | |
return NotificationCompat.Builder(this) | |
.setContentTitle(getString(R.string.app_name)) | |
.setContentText("Phone is $level% charged.") | |
.setSmallIcon(R.mipmap.ic_launcher) | |
.setOnlyAlertOnce(true) | |
.build() | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment