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.
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

Browser Or Native Path (continued)

Native access becomes relevant when the required sensor is not exposed to the browser, when collection must survive app-state changes, or when local storage, notifications, and device services need tighter platform integration.

  • The deciding path is the first one that satisfies the evidence and operational boundary, not the one that sounds more advanced.
  • This makes the implementation choice part of the measurement record and exposes when a browser page cannot meet the required lifecycle behaviour.
  • Older mobile-web stacks such as Wireless Application Protocol (WAP) and Wireless Markup Language (WML) are useful mainly as historical architecture context.
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 4

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 4

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

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

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

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

iotclass.org

Retrieval practice

Recall check 3 of 4

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

Q3A 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, since a resting phone should read zero on every axis.
B9.8 m/s² is a network error code.
CThe value is in the world frame, so it must mean motion.
DIt is gravity in the raw accelerometer, not 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 4 of 4

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

Q4A fitness app integrates gyroscope data assuming a fixed 10 ms interval, but the OS batches sensor events through a sensor hub to save power. Why do the results drift?

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

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

iotclass.org

Print reference

Answers

Answer key.

  1. B · Mobile sensor API choices must record secure-context, permission, availability, sampling, data format, and failure states.
  2. C · Fused sensors are algorithmic combinations of raw accelerometer, gyroscope, and magnetometer data.
  3. D · Raw acceleration bundles gravity with motion; the gravity-removed linear acceleration value would be near zero, showing no real motion.
  4. D · Best-effort, batched delivery means intervals vary; always use the reported timestamps, not an assumed dt.
iotclass.org