1<?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--> 17<sample> 18 <name>BatchStepSensor</name> 19 <group>Sensors</group> 20 <package>com.example.android.batchstepsensor</package> 21 <!-- change minSdk if needed--> 22 <minSdk>19</minSdk> 23 <strings> 24 <intro> 25 <![CDATA[ 26 <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 31 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 37 covered in this sample.</p> 38 ]]> 39 </intro> 40 </strings> 41 42 <template src="base"/> 43 <template src="CardStream"/> 44 <common src="logger"/> 45 <common src="activities"/> 46 <metadata> 47 <status>PUBLISHED</status> 48 <categories>Sensors</categories> 49 <technologies>Android</technologies> 50 <languages>Java</languages> 51 <solutions>Mobile</solutions> 52 <level>ADVANCED</level> 53 <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> 69<![CDATA[ 70Sample demonstrating how to set up SensorEventListeners for step 71detectors and step counters. 72]]> 73 </description> 74 75 <intro> 76<![CDATA[ 77This sample demonstrates the use of the two step [sensors][1] (step detector and counter) and 78sensor batching. 79 80It shows how to register a [SensorEventListener][2] with and without 81batching and shows how these events are received. 82 83The 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. 86 87Both 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. 92 93[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]]> 97 </intro> 98</metadata> 99 100</sample> 101