Skip to content

Instantly share code, notes, and snippets.

@brendan-fahy
Created January 19, 2017 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brendan-fahy/c830a9a026625da02c7bdc9dd3935a7e to your computer and use it in GitHub Desktop.
Save brendan-fahy/c830a9a026625da02c7bdc9dd3935a7e to your computer and use it in GitHub Desktop.
override fun onStartJob(jobParams: JobParameters): Boolean {
val intentFilter = IntentFilter(Intent.ACTION_BATTERY_CHANGED)
val batteryStatus = registerReceiver(null, intentFilter)
notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.notify(Constants.NOTIFICATION_ID, buildNotification(batteryStatus))
jobFinished(jobParams, false)
return false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment