Search by

pushinbr / pam-native-sensors

DavidWilliamBalbino

Motion sensors for PAM Native: one-shot reads and throttled watches of the accelerometer, gyroscope, magnetometer and rotation vector.

Package info

github.com/push-in/pam-native-sensors

Type:pam-native-plugin

pkg:composer/pushinbr/pam-native-sensors

Statistics

Installs: 38

Dependents: 0

Suggesters: 1

Stars: 0

Open Issues: 0

v0.1.0 2026-10-28 15:44 UTC

This package is auto-updated.

Last update: 2026-10-28 15:45:47 UTC


README

Motion sensors for PAM Native apps: one-shot reads and throttled watches of the accelerometer, gyroscope, magnetometer and device motion.

Moved out of the PAM Native core in 1.46: the core keeps only the base every app needs, and this feature ships as a plugin. The native module name and its wire payloads did not change.

Install

composer require pushinbr/pam-native-sensors

Requires pushinbr/pam-native 1.46 or newer (plugin hooks WatchChannel and ActivityResultHost). The plugin is discovered from Composer; no manual registration is needed.

Use

use Pam\Native\Sensors\SensorReading;
use Pam\Native\Sensors\Sensors;
use Pam\Native\Sensors\SensorType;

Sensors::read(SensorType::Accelerometer, static function (?SensorReading $reading): void {});
$watch = Sensors::watch(SensorType::Gyroscope, static function (SensorReading $reading): void {}, intervalMs: 50);
Sensors::unwatch($watch);

Native

  • Module: sensors (Android and iOS).
  • Permissions: none.
  • Android dependencies: none

Migrating from the core

The 1.46 core keeps the old class names (Pam\Native\System\... and the top-level value types) as deprecated aliases of this plugin's classes; they are removed in 1.47. Replace the imports with the Pam\Native\... names above.

Tests

php tests/run.php            # after composer install
PAM_NATIVE_SRC=../pam-native/packages/native/src php tests/run.php