Sensor Applications · Study deck

Mobile Sensor APIs: Measurements and Evidence

This first route maps mobile API families to real sensors and derived values, then checks permission, context, timing, units, frames, and batching.

Physics Phoebe is your guide for this deck.

mobile-sensingweb-apispermissions
Physics Phoebe, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Identify common mobile sensor API families and the measurements they expose.
  • Explain the permission and secure-context checks that gate mobile sensor access.
  • Compare browser-based sensing with native mobile access for an IoT use case.
  • Review mobile sensor data for timestamp, units, accuracy, context, and failure states.
iotclass.org

Major section

Begin With One Phone Reading

An API means a set of rules that lets one piece of software ask another for data or an action.

  • You want its motion reading to mark a rough stop or turn.
  • A sound plan records each state instead of filling a gap with made-up data.
  • A clear app should show each state.
iotclass.org

Major section

Begin With One Phone Reading (continued)

It also says when a web page is enough and when a native app is needed.

  • More access may give more data, but it also raises privacy, battery, and support costs.
  • This short story does not prove that the phone is a calibrated field tool.
  • It should not ask for more access than the task needs.
iotclass.org

Major section

Minimum Viable Understanding

Permission, browser support, secure context, and foreground state can all determine whether a reading is available.

  • Even a successful API value needs units, timestamps, accuracy fields, calibration context, and validation before it becomes trustworthy evidence.
  • Browser APIs fit scoped collection, demonstrations, and lightweight field forms.
  • Native APIs become relevant when the project requires deeper platform integration, richer lifecycle control, or access the browser does not expose.
iotclass.org

Major section

API Access Model

Units, timestamp, accuracy, and context then give that stream meaning before a stop condition closes the collection window.

  • The failure branch is equally important: denial and unsupported states remain part of the record.
  • This ordered path connects API selection to the quality evidence and lifecycle boundaries needed by the sensing claim.
Mobile sensor API access flow: measurement question, support check, permission, reading stream, quality check, stop condition, and record failures.
Mobile sensor API access flow: measurement question, support check, permission, reading stream, quality check, stop condition, and record failures.
iotclass.org

Major section

Common Mobile API Families

Where a Location Fix Actually Comes From walks through what technique is actually running behind that coordinate, indoors and out, and why a raw fix still needs filtering before it becomes a track.

  • Motion and orientation APIs may expose acceleration, rotation rate, and device orientation events depending on platform support.
  • Phone placement—hand-held, pocketed, mounted, or on a table—sets what the signal can represent.
  • A reference movement or validation reading should then show that the recorded direction and scale are plausible.
  • Camera and microphone APIs can support visual or audio sensing, but they carry stronger privacy and context concerns.
iotclass.org

Major section

Browser Or Native Path

The browser path and native path can both be valid, so the choice should follow the measurement need and review evidence.

  • The design must still handle permission denial and unsupported states.
  • That benefit carries platform-specific maintenance and testing obligations.
  • In the Decision map comparing the browser sensing path and the native app path by when each one is a good fit diagram, browser sensing fits a narrow, short-lived activity that needs quick access without installation, runs while the page is visible, and uses an API supported by the target devices.
  • The deciding path is the first one that satisfies the evidence and operational boundary, not the one that sounds more advanced.
Decision map comparing the browser sensing path and the native app path by when each one is a good fit.
Decision map comparing the browser sensing path and the native app path by when each one is a good fit.
iotclass.org

Major section

Data Quality Review

Mobile sensor readings should be reviewed before they are used as evidence.

  • Preserve accuracy or uncertainty when the API exposes it, especially for location, and describe how the phone was held, worn, mounted, or positioned.
  • Permission state must distinguish granted, denied, unavailable, and unsupported outcomes.
  • Close the record with the collection window and its stop reason, then add a known movement, known location, comparison reading, or plausibility check as validation evidence.
iotclass.org

Major section

Common Mistakes

Coordinates without accuracy and time are incomplete; motion values without phone placement are ambiguous.

  • Browser support varies, so denied, unsupported, stale, and interrupted states must remain visible.
  • Narrow phone data cannot justify broad activity, safety, or health claims.
  • Every collection plan also needs an explicit stop condition and a retest trigger so changed access or setup cannot silently inherit an old conclusion.
iotclass.org

Major section

A Phone Reports More Sensors Than It Has

The fused output is an inference whose failure modes include the inputs and the algorithm, not a separate physical chip.

  • This connects API selection to the chapter's requirement to record signal type and provenance.
Mobile sensor fusion pipeline from raw phone inputs to application actions
Mobile sensor fusion pipeline from raw phone inputs to application actions
iotclass.org

Deck summary

Key takeaways

An API means a set of rules that lets one piece of software ask another for data or an action.

  • It also says when a web page is enough and when a native app is needed.
  • Permission, browser support, secure context, and foreground state can all determine whether a reading is available.
  • Units, timestamp, accuracy, and context then give that stream meaning before a stop condition closes the collection window.
  • Where a Location Fix Actually Comes From walks through what technique is actually running behind that coordinate, indoors and out, and why a raw fix still needs filtering before it becomes a track.
iotclass.org

Retrieval practice

Recall check 1 of 6

Physics Phoebe says: answer from memory, then check your reasoning.

Q1A browser-based lab needs device orientation data, but the user denies permission. What should the record show?

AA fabricated orientation value so the rest of the lab can continue
BRecord denied or unavailable state with the access path.
CA statement that permissions do not matter for sensor evidence
DA switch to a different API without documenting why
Show answer

Answer: B Mobile sensor API choices must record secure-context, permission, availability, sampling, data format, and failure states.

iotclass.org

Retrieval practice

Recall check 2 of 6

Physics Phoebe says: answer from memory, then check your reasoning.

Q2An app needs to tell whether a mounted phone tilted. Which API family most directly supplies the reading?

AThe cloud timestamp API, mistaking upload time for phone tilt.
BThe motion and orientation APIs, recording axes and units.
CThe microphone API alone, treating sound as a tilt reading.
DThe contacts API, which contains no mounted-phone motion signal.
Show answer

Answer: B Tilt depends on the phone’s orientation frame and measurement context.

iotclass.org

Retrieval practice

Recall check 3 of 6

Physics Phoebe says: answer from memory, then check your reasoning.

Q3A team chose a phone motion API for an IoT field test. Which evidence belongs with the API choice?

AA preferred library name alone, omitting permission, axes, placement, and test movement.
BA later upload count alone, with no axes, units, or motion validation.
CPermission and support, axes, units, event time, placement, and test movement.
DAn API name alone, with no support state or field validation record.
Show answer

Answer: C Those facts bound what the motion reading can mean.

iotclass.org

Retrieval practice

Recall check 4 of 6

Physics Phoebe says: answer from memory, then check your reasoning.

Q4On a phone, a 'linear acceleration' or 'rotation vector' sensor is best described as what?

AA fused (virtual) sensor computed in software from raw hardware sensors.
BA dedicated physical chip separate from the accelerometer and gyroscope.
CA network service that returns motion from a server.
DA calibration certificate for the accelerometer.
Show answer

Answer: A Fused sensors are algorithmic combinations of raw accelerometer, gyroscope, and magnetometer data.

iotclass.org

Retrieval practice

Recall check 5 of 6

Physics Phoebe says: answer from memory, then check your reasoning.

Q5A resting phone's raw accelerometer reads about 9.8 m/s² along one axis. A developer logs this as 'the phone accelerated hard.' What went wrong?

AThe accelerometer is broken because still phones read zero on all axes.
BThe value is a network error code rather than measured acceleration.
CThe world-frame value proves hard phone motion while it rests.
DThe raw reading includes gravity, not a sudden hard motion.
Show answer

Answer: D Raw acceleration bundles gravity with motion; the gravity-removed linear acceleration value would be near zero, showing no real motion.

iotclass.org

Retrieval practice

Recall check 6 of 6

Physics Phoebe says: answer from memory, then check your reasoning.

Q6A fitness app integrates gyroscope data assuming a fixed 10 ms interval, but event timestamps show the intervals differ while the OS batches events through a sensor hub. Why do the results drift?

AUse each event timestamp; batching makes intervals jitter.
BBatching changes the gyroscope's physical sensitivity between delivered samples.
CThe sensor hub corrupts angular-rate values before the app receives them.
DGyroscopes cannot be integrated into angle in any mobile sensing workflow.
Show answer

Answer: A Best-effort, batched delivery means intervals vary; always use the reported timestamps, not an assumed dt.

iotclass.org

Print reference

Answers 1 of 2

Answer key.

  1. B · Mobile sensor API choices must record secure-context, permission, availability, sampling, data format, and failure states.
  2. B · Tilt depends on the phone’s orientation frame and measurement context.
  3. C · Those facts bound what the motion reading can mean.
  4. A · Fused sensors are algorithmic combinations of raw accelerometer, gyroscope, and magnetometer data.
  5. D · Raw acceleration bundles gravity with motion; the gravity-removed linear acceleration value would be near zero, showing no real motion.
iotclass.org

Print reference

Answers 2 of 2

Answer key.

  1. A · Best-effort, batched delivery means intervals vary; always use the reported timestamps, not an assumed dt.
iotclass.org