Skip to content

Instantly share code, notes, and snippets.

@brendan-fahy
Created January 19, 2017 22:43
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/ad1eeb7e6cb1b1e82e1b4a444f8bd8c2 to your computer and use it in GitHub Desktop.
Save brendan-fahy/ad1eeb7e6cb1b1e82e1b4a444f8bd8c2 to your computer and use it in GitHub Desktop.
if (isCharging || isUnknown) {
jobScheduler.schedule(jobInfo(context))
} else if (hasBeenDisconnected) {
jobScheduler.cancelAll()
// FIXME this is a pretty hacky way of getting the job done :(
(context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager)
.cancel(NOTIFICATION_ID)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment