Created
March 25, 2020 22:48
-
-
Save jcbribeiro/f9c09a2d731cd87351e7330154b4ed7e to your computer and use it in GitHub Desktop.
register primitive fences
This file contains hidden or 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
| fun onClick_button_register(view: View?) { | |
| val headphoneFence: AwarenessFence = HeadphoneFence.during(HeadphoneState.PLUGGED_IN) | |
| addFence("headphoneFence", headphoneFence) | |
| val walkingFence: AwarenessFence = DetectedActivityFence.during(DetectedActivityFence.WALKING) | |
| addFence("walkingFence", walkingFence) | |
| val nowMillis = System.currentTimeMillis() | |
| val oneMinuteMilis = 60L * 1000L | |
| val thirtySecondsMillis = 30L * 1000L | |
| val timeFence: AwarenessFence = TimeFence.inInterval( | |
| nowMillis + thirtySecondsMillis, // starting in thirty seconds | |
| nowMillis + thirtySecondsMillis + oneMinuteMilis // lasts for one minute | |
| ) | |
| addFence("timeFence", timeFence) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment