1 Android BatchStepSensor Sample 2 =================================== 3 4 Sample demonstrating how to set up SensorEventListeners for step 5 detectors and step counters. 6 7 Introduction 8 ------------ 9 10 This sample demonstrates the use of the two step [sensors][1] (step detector and counter) and 11 sensor batching. 12 13 It shows how to register a [SensorEventListener][2] with and without 14 batching and shows how these events are received. 15 16 The Step Detector sensor fires an 17 event when a step is detected, while the step counter returns the total number of 18 steps since a listener was first registered for this sensor. 19 20 Both sensors only count steps while a listener is registered. This sample only covers the 21 basic case, where a listener is only registered while the app is running. Likewise, 22 batched sensors can be used in the background (when the CPU is suspended), which 23 requires manually flushing the [sensor event][3] queue before it overflows, which is not 24 covered in this sample. 25 26 [1]: https://developer.android.com/reference/android/hardware/Sensor.html 27 [2]: https://developer.android.com/reference/android/hardware/SensorEventListener.html 28 [3]: https://developer.android.com/reference/android/hardware/SensorEvent.html 29 30 Pre-requisites 31 -------------- 32 33 - Android SDK v21 34 - Android Build Tools v21.1.1 35 - Android Support Repository 36 37 Screenshots 38 ------------- 39 40 <img src="screenshots/screenshot1.png" height="400" alt="Screenshot"/> <img src="screenshots/screenshot2.png" height="400" alt="Screenshot"/> <img src="screenshots/screenshot3.png" height="400" alt="Screenshot"/> <img src="screenshots/screenshot4.png" height="400" alt="Screenshot"/> <img src="screenshots/screenshot5.png" height="400" alt="Screenshot"/> <img src="screenshots/screenshot6.png" height="400" alt="Screenshot"/> 41 42 Getting Started 43 --------------- 44 45 This sample uses the Gradle build system. To build this project, use the 46 "gradlew build" command or use "Import Project" in Android Studio. 47 48 Support 49 ------- 50 51 - Google+ Community: https://plus.google.com/communities/105153134372062985968 52 - Stack Overflow: http://stackoverflow.com/questions/tagged/android 53 54 If you've found an error in this sample, please file an issue: 55 https://github.com/googlesamples/android-BatchStepSensor 56 57 Patches are encouraged, and may be submitted by forking this project and 58 submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. 59 60 License 61 ------- 62 63 Copyright 2014 The Android Open Source Project, Inc. 64 65 Licensed to the Apache Software Foundation (ASF) under one or more contributor 66 license agreements. See the NOTICE file distributed with this work for 67 additional information regarding copyright ownership. The ASF licenses this 68 file to you under the Apache License, Version 2.0 (the "License"); you may not 69 use this file except in compliance with the License. You may obtain a copy of 70 the License at 71 72 http://www.apache.org/licenses/LICENSE-2.0 73 74 Unless required by applicable law or agreed to in writing, software 75 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 76 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 77 License for the specific language governing permissions and limitations under 78 the License. 79