From 6a3c5430fcf37ce03ec092203d27d81b1d4db288 Mon Sep 17 00:00:00 2001 From: Nguyen Ngo Date: Thu, 28 Aug 2025 16:48:18 -0400 Subject: [PATCH] Fix checkin page Android location issue --- templates/qr_destination.html | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/templates/qr_destination.html b/templates/qr_destination.html index 951bd2b..9318bf4 100644 --- a/templates/qr_destination.html +++ b/templates/qr_destination.html @@ -938,18 +938,34 @@ } locationCaptureActive = true; - console.log("📍 Requesting enhanced location data..."); + console.log("📍 Requesting enhanced location data (high accuracy)..."); - const options = { + const highAccuracyOptions = { enableHighAccuracy: true, - timeout: 10000, - maximumAge: 300000, + timeout: 15000, // 15 sec for GPS attempt + maximumAge: 300000 }; navigator.geolocation.getCurrentPosition( handleEnhancedLocationSuccess, - handleEnhancedLocationError, - options + function(error) { + console.warn("⚠️ High accuracy failed:", error.message); + + // Fallback to low accuracy + const lowAccuracyOptions = { + enableHighAccuracy: false, + timeout: 10000, + maximumAge: 600000 + }; + + console.log("📍 Retrying with low accuracy..."); + navigator.geolocation.getCurrentPosition( + handleEnhancedLocationSuccess, + handleEnhancedLocationError, + lowAccuracyOptions + ); + }, + highAccuracyOptions ); }