xref: /aosp_15_r20/development/samples/browseable/BatchStepSensor/_index.jd (revision 90c8c64db3049935a07c6143d7fd006e26f8ecca)
1*90c8c64dSAndroid Build Coastguard Worker
2*90c8c64dSAndroid Build Coastguard Workerpage.tags="BatchStepSensor"
3*90c8c64dSAndroid Build Coastguard Workersample.group=Sensors
4*90c8c64dSAndroid Build Coastguard Worker@jd:body
5*90c8c64dSAndroid Build Coastguard Worker
6*90c8c64dSAndroid Build Coastguard Worker<p>
7*90c8c64dSAndroid Build Coastguard Worker
8*90c8c64dSAndroid Build Coastguard Worker            <p>This sample demonstrates the use of the two step sensors (step detector and counter) and
9*90c8c64dSAndroid Build Coastguard Worker            sensor batching.</p>
10*90c8c64dSAndroid Build Coastguard Worker            <p>It shows how to register a SensorEventListener with and without
11*90c8c64dSAndroid Build Coastguard Worker            batching and shows how these events are received.</p>
12*90c8c64dSAndroid Build Coastguard Worker            <p>The Step Detector sensor fires an
13*90c8c64dSAndroid Build Coastguard Worker            event when a step is detected, while the step counter returns the total number of
14*90c8c64dSAndroid Build Coastguard Worker            steps since a listener was first registered for this sensor.
15*90c8c64dSAndroid Build Coastguard Worker            Both sensors only count steps while a listener is registered. This sample only covers the
16*90c8c64dSAndroid Build Coastguard Worker            basic case, where a listener is only registered while the app is running. Likewise,
17*90c8c64dSAndroid Build Coastguard Worker            batched sensors can be used in the background (when the CPU is suspended), which
18*90c8c64dSAndroid Build Coastguard Worker            requires manually flushing the sensor event queue before it overflows, which is not
19*90c8c64dSAndroid Build Coastguard Worker            covered in this sample.</p>
20*90c8c64dSAndroid Build Coastguard Worker
21*90c8c64dSAndroid Build Coastguard Worker        </p>
22