Skip to content

Instantly share code, notes, and snippets.

@brendan-fahy
Created January 19, 2017 20:38
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/5c8ce6a3c6508ad3cd502fa7ff3b7845 to your computer and use it in GitHub Desktop.
Save brendan-fahy/5c8ce6a3c6508ad3cd502fa7ff3b7845 to your computer and use it in GitHub Desktop.
val intentFilter = IntentFilter(Intent.ACTION_BATTERY_CHANGED)
val batteryStatus = context.registerReceiver(null, intentFilter)
val status = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment