PHP code example of projectmata / mobile-geolocation
1. Go to this page and download the library: Download projectmata/mobile-geolocation library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
projectmata / mobile-geolocation example snippets
use Projectmata\MobileGeolocation\Facades\Geolocation;
// Ask the OS for location permission (no-op if already granted)
$perm = Geolocation::requestPermission();
// Then read the position
$pos = Geolocation::getCurrentPosition(highAccuracy: true);
// $pos = ['success' => true, 'latitude' => ..., 'longitude' => ..., 'accuracy' => ...]
bash
php artisan native:run android
# or
php artisan native:run ios