Skip to content

Instantly share code, notes, and snippets.

@jcbribeiro
Created March 25, 2020 22:59
Show Gist options
  • Select an option

  • Save jcbribeiro/f646cd48f143689d0d377e5f047c7cfb to your computer and use it in GitHub Desktop.

Select an option

Save jcbribeiro/f646cd48f143689d0d377e5f047c7cfb to your computer and use it in GitHub Desktop.
register walkingWithHeadphonesFence
val walkingWithHeadphonesFence = AwarenessFence.and(
walkingFence, headphoneFence
)
addFence("walkingWithHeadphonesFence", walkingWithHeadphonesFence)
/* in FenceReceiver
"walkingWithHeadphonesFence" -> when (fenceState.currentState) {
FenceState.TRUE -> fenceInfo = "TRUE | Walking with headphones plugged in."
FenceState.FALSE -> fenceInfo = "FALSE | Not walking with headphones plugged in."
FenceState.UNKNOWN -> fenceInfo = "Error: unknown state."
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment