Jan-Felix Schmakeit | 56216a8 | 2014-01-02 11:41:04 +1100 | [diff] [blame] | 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 | --> |
Jan-Felix Schmakeit | 56216a8 | 2014-01-02 11:41:04 +1100 | [diff] [blame] | 17 | <sample> |
| 18 | <name>BatchStepSensor</name> |
| 19 | <group>Sensors</group> |
| 20 | <package>com.example.android.batchstepsensor</package> |
Jan-Felix Schmakeit | 56216a8 | 2014-01-02 11:41:04 +1100 | [diff] [blame] | 21 | <!-- change minSdk if needed--> |
| 22 | <minSdk>19</minSdk> |
Jan-Felix Schmakeit | 56216a8 | 2014-01-02 11:41:04 +1100 | [diff] [blame] | 23 | <strings> |
| 24 | <intro> |
| 25 | <![CDATA[ |
Benjamin Weiss | 91e8278 | 2014-11-25 11:48:10 +0000 | [diff] [blame] | 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 |
Jan-Felix Schmakeit | 56216a8 | 2014-01-02 11:41:04 +1100 | [diff] [blame] | 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 |
Benjamin Weiss | 91e8278 | 2014-11-25 11:48:10 +0000 | [diff] [blame] | 37 | covered in this sample.</p> |
Jan-Felix Schmakeit | 56216a8 | 2014-01-02 11:41:04 +1100 | [diff] [blame] | 38 | ]]> |
| 39 | </intro> |
| 40 | </strings> |
| 41 | |
| 42 | <template src="base"/> |
| 43 | <template src="CardStream"/> |
| 44 | <common src="logger"/> |
| 45 | <common src="activities"/> |
Benjamin Weiss | 91e8278 | 2014-11-25 11:48:10 +0000 | [diff] [blame] | 46 | <metadata> |
| 47 | <status>PUBLISHED</status> |
| 48 | <categories>Sensors</categories> |
| 49 | <technologies>Android</technologies> |
| 50 | <languages>Java</languages> |
| 51 | <solutions>Mobile</solutions> |
Benjamin Weiss | b6f86d5 | 2014-12-04 15:38:29 +0000 | [diff] [blame] | 52 | <level>ADVANCED</level> |
Benjamin Weiss | 91e8278 | 2014-11-25 11:48:10 +0000 | [diff] [blame] | 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> |
Benjamin Weiss | b6f86d5 | 2014-12-04 15:38:29 +0000 | [diff] [blame] | 69 | <![CDATA[ |
| 70 | Sample demonstrating how to set up SensorEventListeners for step |
| 71 | detectors and step counters. |
| 72 | ]]> |
Benjamin Weiss | 91e8278 | 2014-11-25 11:48:10 +0000 | [diff] [blame] | 73 | </description> |
| 74 | |
| 75 | <intro> |
Benjamin Weiss | b6f86d5 | 2014-12-04 15:38:29 +0000 | [diff] [blame] | 76 | <![CDATA[ |
| 77 | This sample demonstrates the use of the two step [sensors][1] (step detector and counter) and |
| 78 | sensor batching. |
Benjamin Weiss | 91e8278 | 2014-11-25 11:48:10 +0000 | [diff] [blame] | 79 | |
Benjamin Weiss | b6f86d5 | 2014-12-04 15:38:29 +0000 | [diff] [blame] | 80 | It shows how to register a [SensorEventListener][2] with and without |
| 81 | batching and shows how these events are received. |
Benjamin Weiss | 91e8278 | 2014-11-25 11:48:10 +0000 | [diff] [blame] | 82 | |
Benjamin Weiss | b6f86d5 | 2014-12-04 15:38:29 +0000 | [diff] [blame] | 83 | The Step Detector sensor fires an |
| 84 | event when a step is detected, while the step counter returns the total number of |
| 85 | steps since a listener was first registered for this sensor. |
Benjamin Weiss | 91e8278 | 2014-11-25 11:48:10 +0000 | [diff] [blame] | 86 | |
Benjamin Weiss | b6f86d5 | 2014-12-04 15:38:29 +0000 | [diff] [blame] | 87 | Both sensors only count steps while a listener is registered. This sample only covers the |
| 88 | basic case, where a listener is only registered while the app is running. Likewise, |
| 89 | batched sensors can be used in the background (when the CPU is suspended), which |
| 90 | requires manually flushing the [sensor event][3] queue before it overflows, which is not |
| 91 | covered in this sample. |
Benjamin Weiss | 91e8278 | 2014-11-25 11:48:10 +0000 | [diff] [blame] | 92 | |
Benjamin Weiss | b6f86d5 | 2014-12-04 15:38:29 +0000 | [diff] [blame] | 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 | ]]> |
Benjamin Weiss | 91e8278 | 2014-11-25 11:48:10 +0000 | [diff] [blame] | 97 | </intro> |
| 98 | </metadata> |
Jan-Felix Schmakeit | 56216a8 | 2014-01-02 11:41:04 +1100 | [diff] [blame] | 99 | |
| 100 | </sample> |