Download the PHP package denniskrol/nativephp-geolocation without Composer
On this page you can find all versions of the php package denniskrol/nativephp-geolocation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download denniskrol/nativephp-geolocation
More information about denniskrol/nativephp-geolocation
Files in denniskrol/nativephp-geolocation
Package nativephp-geolocation
Short Description Custom geolocation plugin for NativePHP Mobile
License MIT
Informations about the package nativephp-geolocation
Projectmata Mobile Geolocation
Geolocation plugin for NativePHP Mobile. Reads the device's current position on Android and iOS with a single call.
Requirements
- PHP
^8.4 - Laravel
^11.0or^12.0/^13.0 nativephp/mobile- Android:
min_version 33, depends oncom.google.android.gms:play-services-location:21.3.0 - iOS:
min_version 18.2
Installation
Rebuild the mobile app so NativePHP wires up the native plugin and permissions:
Permissions
The package declares these for you via its nativephp.json manifest — you don't need to add them manually:
- Android —
ACCESS_COARSE_LOCATION,ACCESS_FINE_LOCATION,ACCESS_BACKGROUND_LOCATION - iOS —
NSLocationWhenInUseUsageDescriptionis set to "This app uses your location to show your current position." Override it in your app'sinfo_plistconfig if you want different copy.
Always call requestPermission() before requesting a position, and handle the case where the user denies.
For Android background work, request foreground permission while the app is open, then call
requestBackgroundPermission(). Android 11 and later opens the app's settings screen because
the user must explicitly choose Allow all the time there. Background jobs must never try to
display permission prompts.
Usage
PHP (Laravel)
JavaScript (in-app)
The plugin registers itself on window.NativePHP.Geolocation:
Or as a bundled import:
Bridge methods
| Method | Params | Returns |
|---|---|---|
Geolocation.RequestPermission |
— | { success, granted } |
Geolocation.GetCurrentPosition |
{ highAccuracy: boolean } |
{ success, latitude, longitude, accuracy, timestamp } |
Geolocation.RequestBackgroundPermission |
— | { granted, message } |
Geolocation.HasBackgroundPermission |
— | { granted } |
Geolocation.GetBackgroundPosition |
{ highAccuracy: boolean } |
Position or BACKGROUND_LOCATION_PERMISSION_DENIED error |
getCurrentPosition() works with either an Android activity or application context and uses an
active Fused Location request. getBackgroundPosition() additionally requires Android background
location permission, making it appropriate for scheduler and job integrations without coupling this
package to any particular background-task plugin. The highAccuracy flag maps to Fused Location's
high-accuracy mode on Android and kCLLocationAccuracyBest on iOS.
License
MIT