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