Search by

pushinbr / pam-native-location

DavidWilliamBalbino

Device location for PAM Native: current and last known position, watches, and the location services switch.

Package info

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

Language:Kotlin

Type:pam-native-plugin

pkg:composer/pushinbr/pam-native-location

Statistics

Installs: 43

Dependents: 0

Suggesters: 1

Stars: 0

Open Issues: 0

v0.1.1 2026-11-18 01:13 UTC

This package is auto-updated.

Last update: 2026-11-18 04:03:03 UTC


README

pam-native-location: Current and last known position, throttled watches and the location services switch.

Device location for PAM Native apps, written in PHP.
Current and last known position, throttled watches, the location services switch and typed failures.

Packagist Latest release PHP 8.5 CI License

Install · Quick example · Platforms · Permissions · Docs · Issues

Install

Inside a PAM Native project, add only this capability:

pam composer require pushinbr/pam-native-location
pam doctor --fix

Requires pushinbr/pam-native 1.46 or newer (plugin hooks WatchChannel and ActivityResultHost). The plugin is discovered from Composer; no manual registration is needed. New to PAM? Create a project with pam init my-app --template native (see the PAM Native overview).

Quick example

use Pam\Native\Location\Location;
use Pam\Native\Location\LocationError;
use Pam\Native\Location\LocationPosition;

Location::current(
    static function (LocationPosition $position): void {
        // $position->latitude, $position->longitude, $position->accuracy
    },
    failure: static function (string $failure): void {
        $error = LocationError::fromFailure($failure); // Permission, Disabled, Unavailable, Timeout
    },
);

Location::watch() delivers continuous updates filtered by distance and interval until Location::clearWatch(); Location::lastKnown() reads the cached fix without turning on GPS; servicesEnabled(), requestServices() and openSettings() handle the location services switch.

Platform support

Platform Support Notes
Android API 24+ Play Services Location 21.4.0 (fused provider; LocationManager fallback without Play Services)
iOS 15.0+ CoreLocation
PAM Native 1.46.0 to < 2.0.0 From pam-native.plugin.json; PHP 8.5+

Permissions and requirements

Platform Declared by the plugin
Android android.permission.ACCESS_FINE_LOCATION, android.permission.ACCESS_COARSE_LOCATION
iOS NSLocationWhenInUseUsageDescription ("Use your location.")

Native module: location (Android and iOS).

Migrating from the core

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

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\Location\... names above.

Tests

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

Docs

Part of the PAM ecosystem

PAM

PAM runs PHP natively on servers, desktops and phones. This repository is one piece of it.

PAM PAM Desktop PAM Native Ecosystem
the runtime and CLI native desktop apps in PHP native Android and iOS apps in PHP every official package and plugin

Docs: push-in.github.io/pam-docs · Issues

Apache License 2.0 · Made in Brazil by Pushin