blob: 0f2ffbb8f68491e5a1b8a532b3ecab36508af1a6 [file] [log] [blame]
Jan-Felix Schmakeit56216a82014-01-02 11:41:04 +11001<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 Copyright 2013 The Android Open Source Project
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16-->
Jan-Felix Schmakeit56216a82014-01-02 11:41:04 +110017<sample>
18 <name>BatchStepSensor</name>
19 <group>Sensors</group>
20 <package>com.example.android.batchstepsensor</package>
Jan-Felix Schmakeit56216a82014-01-02 11:41:04 +110021 <!-- change minSdk if needed-->
22 <minSdk>19</minSdk>
Jan-Felix Schmakeit56216a82014-01-02 11:41:04 +110023 <strings>
24 <intro>
25 <![CDATA[
Benjamin Weiss91e82782014-11-25 11:48:10 +000026 <p>This sample demonstrates the use of the two step sensors (step detector and counter) and
27 sensor batching.</p>
28 <p>It shows how to register a SensorEventListener with and without
29 batching and shows how these events are received.</p>
30 <p>The Step Detector sensor fires an
Jan-Felix Schmakeit56216a82014-01-02 11:41:04 +110031 event when a step is detected, while the step counter returns the total number of
32 steps since a listener was first registered for this sensor.
33 Both sensors only count steps while a listener is registered. This sample only covers the
34 basic case, where a listener is only registered while the app is running. Likewise,
35 batched sensors can be used in the background (when the CPU is suspended), which
36 requires manually flushing the sensor event queue before it overflows, which is not
Benjamin Weiss91e82782014-11-25 11:48:10 +000037 covered in this sample.</p>
Jan-Felix Schmakeit56216a82014-01-02 11:41:04 +110038 ]]>
39 </intro>
40 </strings>
41
42 <template src="base"/>
43 <template src="CardStream"/>
44 <common src="logger"/>
45 <common src="activities"/>
Benjamin Weiss91e82782014-11-25 11:48:10 +000046 <metadata>
47 <status>PUBLISHED</status>
48 <categories>Sensors</categories>
49 <technologies>Android</technologies>
50 <languages>Java</languages>
51 <solutions>Mobile</solutions>
Benjamin Weissb6f86d52014-12-04 15:38:29 +000052 <level>ADVANCED</level>
Benjamin Weiss91e82782014-11-25 11:48:10 +000053 <icon>screenshots/big_icon.png</icon>
54 <screenshots>
55 <img>screenshots/screenshot1.png</img>
56 <img>screenshots/screenshot2.png</img>
57 <img>screenshots/screenshot3.png</img>
58 <img>screenshots/screenshot4.png</img>
59 <img>screenshots/screenshot5.png</img>
60 <img>screenshots/screenshot6.png</img>
61 </screenshots>
62 <api_refs>
63 <android>android.hardware.Sensor</android>
64 <android>android.hardware.SensorEvent</android>
65 <android>android.hardware.SensorEventListener</android>
66 <android>android.hardware.SensorManager</android>
67 </api_refs>
68 <description>
Benjamin Weissb6f86d52014-12-04 15:38:29 +000069<![CDATA[
70Sample demonstrating how to set up SensorEventListeners for step
71detectors and step counters.
72]]>
Benjamin Weiss91e82782014-11-25 11:48:10 +000073 </description>
74
75 <intro>
Benjamin Weissb6f86d52014-12-04 15:38:29 +000076<![CDATA[
77This sample demonstrates the use of the two step [sensors][1] (step detector and counter) and
78sensor batching.
Benjamin Weiss91e82782014-11-25 11:48:10 +000079
Benjamin Weissb6f86d52014-12-04 15:38:29 +000080It shows how to register a [SensorEventListener][2] with and without
81batching and shows how these events are received.
Benjamin Weiss91e82782014-11-25 11:48:10 +000082
Benjamin Weissb6f86d52014-12-04 15:38:29 +000083The Step Detector sensor fires an
84event when a step is detected, while the step counter returns the total number of
85steps since a listener was first registered for this sensor.
Benjamin Weiss91e82782014-11-25 11:48:10 +000086
Benjamin Weissb6f86d52014-12-04 15:38:29 +000087Both sensors only count steps while a listener is registered. This sample only covers the
88basic case, where a listener is only registered while the app is running. Likewise,
89batched sensors can be used in the background (when the CPU is suspended), which
90requires manually flushing the [sensor event][3] queue before it overflows, which is not
91covered in this sample.
Benjamin Weiss91e82782014-11-25 11:48:10 +000092
Benjamin Weissb6f86d52014-12-04 15:38:29 +000093[1]: https://developer.android.com/reference/android/hardware/Sensor.html
94[2]: https://developer.android.com/reference/android/hardware/SensorEventListener.html
95[3]: https://developer.android.com/reference/android/hardware/SensorEvent.html
96]]>
Benjamin Weiss91e82782014-11-25 11:48:10 +000097 </intro>
98</metadata>
Jan-Felix Schmakeit56216a82014-01-02 11:41:04 +110099
100</sample>