Web Geolocation API vs Native App for Location Features

Web Geolocation API vs Native App for Location Features

Map parity between the W3C Geolocation API plus Permissions API plus PWAs and native iOS/Android — pick web first, reserve native install for users who need background context or beacon scanning.

The modern web platform — the W3C Geolocation API, the Permissions API, installable Progressive Web Apps, service workers, and, for web apps saved to the Home Screen, iOS Web Push since version 16.4 in March 2023 — covers the foreground location features this guide lists, including store finders, region defaults, museum and tourism tours behind QR codes, and registration-time region gates. What remains native-only for a public site is background location updates, geofence enter and exit triggers that wake the application, iBeacon scanning (Web Bluetooth scanning exists only behind a Chrome experimental flag), and headless dwell-time analytics. This guide maps the parity gap honestly, walks through the iOS PWA install gate that brackets Web Push, and lays out a decision frame for choosing web first and reserving native install for users who cross a value threshold.

What the W3C Geolocation API gives you

The Geolocation API exposes two methods on navigator.geolocation — getCurrentPosition for a one-shot fix and watchPosition for a stream of updates — along with a clearWatch method for tearing the stream down. The signature has been stable since the original specification, every modern browser implements the same surface, and the W3C Geolocation API specification is the canonical reference for the contract.

javascript
navigator.geolocation.getCurrentPosition(
  (position) => {
    const { latitude, longitude, accuracy } = position.coords
    renderNearbyResults(latitude, longitude, accuracy)
  },
  (error) => fallbackToManualRegionPicker(error.code),
  { enableHighAccuracy: true, timeout: 8000, maximumAge: 60000 }
)

The Geolocation specification leaves how a position is obtained to the browser; Chrome on Android, for example, says that when you allow sites to use your location, it sends information to Google Location Services to get an estimate of where you are. That browsers draw on the same platform location services a native app would call — Core Location on iOS, the fused location provider on Android — is a working hypothesis, not a documented rule. Either way, the precision the page receives is bounded by what the device can measure and, in iOS 14, iPadOS 14, and later, by whether Precise Location is turned on for the browser app in Location Services settings. GPS.gov says GPS-enabled smartphones are typically accurate to within a 4.9 m (16 ft.) radius under open sky, and that their accuracy worsens near buildings, bridges, and trees.

The Permissions API closes the loop on permission state. A site can read whether the user has already granted, denied, or not yet been prompted for geolocation, and branch the experience without ever triggering a permission prompt the user has not asked for. The W3C Permissions API specification defines the three states — granted, denied, and prompt — that the rest of this guide builds on.

javascript
const status = await navigator.permissions.query({ name: 'geolocation' })
if (status.state === 'granted') startLocationFeature()
else if (status.state === 'prompt') showCustomPrimerThenRequest()
else if (status.state === 'denied') showManualRegionPickerOnly()

Installed Progressive Web Apps inherit the same surface. Once a user installs a PWA via the browser's Add to Home Screen flow, the PWA can call the API from offline-first service worker cached pages. How long the geolocation grant lasts across launches is up to the browser — the Geolocation specification notes that permission lifetimes vary across user agents — so test it on each target platform rather than assuming it behaves like a native app's permission. For the foreground features this guide lists, the capability surface that a website can reach has converged on the capability surface a native app needs; beacon proximity scanning, covered below, stays out of reach even in the foreground.

What is missing on the web platform

The honest map of the gap is short but load-bearing. Background location is unavailable. A web page cannot receive position updates while its document is hidden — a background tab, or a minimized or backgrounded browser — because the specification delivers updates only to fully active, visible documents; a visible page in a window that merely lacks focus still receives them, and the locked-screen case is worth testing on each target browser rather than assuming updates continue. Service workers can respond to push messages and, in Chromium-based browsers as of November 2026, run periodic background sync tasks, but they cannot subscribe to location updates and they cannot wake on geofence enter or exit. The visibility limit is deliberate — the specification's note calls it the desired effect.

iBeacon scanning is unavailable in practice. Web Bluetooth, supported in Chrome on Android, ChromeOS, macOS, and Windows, in Edge 79 and later, and in Samsung Internet and Opera on Android (not in Chrome on iOS, on Linux only partially implemented, not supported, and behind an experimental flag that must be enabled, and not in Firefox or Safari; as of November 2026), exposes the BLE GATT connection-oriented surface — pairing with a device, reading and writing characteristics, subscribing to notifications. Its methods for scanning the beacon advertisements that iBeacon and Eddystone deployments rely on (requestLEScan and watchAdvertisements) remain experimental and, as of November 2026, are listed only behind Chrome's experimental web platform features flag — advertisement scanning on Android and macOS, and watchAdvertisements() on Android, macOS, and Windows — per the Web Bluetooth implementation status. A page cannot listen for beacon proximity events for ordinary visitors the way a native app calling Core Location's region monitoring, or an Android app scanning with BluetoothLeScanner directly or through a beacon library such as the AltBeacon library's BeaconManager, can, and a flag-gated API is not a workaround a public site can ship.

Geofence enter and exit triggers are unavailable. The pattern that ad networks and retail attribution platforms rely on — an enter, exit, or dwell signal that fires when the device crosses a virtual boundary or stays inside it for a set time, even when the application is not running — requires a platform geofence service that only native apps can reach: Core Location's region monitoring on iOS and, on Android, the GeofencingClient API in Google Play services. The browser does not bind to that service.

Reliable wake-on-location is unavailable. Service workers can be woken by push messages and, in Chromium-based browsers, by background sync events, but neither path lets the worker request a fresh position fix from the OS — the geolocation API is gated to documents with a window context, not to worker scopes. A site cannot proactively poll for a position change while the user is doing something else.

Three of the four gaps come down to one capability, passive background context; the fourth, beacon proximity scanning, is unavailable to public sites even in the foreground.

Where iOS and Android diverge

Permission persistence works differently across the two platforms in ways that show up as user-experience papercuts if a team ships the same code without testing both. Apple's Location Services help describes Allow Once as a choice for apps; it does not describe how long Safari keeps a website's location permission. A working hypothesis, not a documented rule, is that a one-time grant to a website in iOS Safari does not persist across page reloads or new sessions — test both on iOS. On Android, the Only this time option that Android 11 introduced in September 2020 applies to an app's own permission request, including Chrome's request for device location; that option does not settle whether a website's grant in Chrome lasts only for the session, so test it in Chrome on Android.

Installed PWAs add another variable on both platforms. On Android, how long an installed PWA keeps the geolocation grant across launches and device restarts is up to the browser, so test it rather than assuming it behaves like a native app's permission. On iOS, confirm against Apple's current documentation how long a Home Screen web app keeps a location grant, and teams shipping PWAs to iOS audiences should test permission persistence after a forced cold start rather than assuming Android behavior carries over.

Web Push is the most-discussed iOS divergence. Apple shipped iOS Web Push in version 16.4 in March 2023, announced in the WebKit blog post on Web Push for iOS, and the web.dev push notifications overview explains the general push notification model. The constraint is that an iOS user must add the site to the home screen first. A site that serves a web app manifest with its display member set to standalone or fullscreen then runs as a Home Screen web app, which can request push permission in response to direct user interaction, such as a tap on a subscribe button; iOS then prompts the user, and once allowed, the permission is managed per web app in Notifications Settings like any other app. On Android, as of November 2026, Web Push works in regular browser tabs without an install requirement, and the conversion path is shorter.

This asymmetry shapes the rollout sequence. A team that ships Web Push without first solving the Add to Home Screen funnel on iOS can see push opt-in on iOS lag Android, because on iOS only Home Screen web apps can ask for push permission. The mobile-web article on this topic covers the iOS install gate and install-prompt timing — surfacing the install option after a value moment rather than on first load — alongside the primed permission prompts that protect the grant rate.

Permissions API and graceful degradation

The Permissions API is a useful tool for a low-friction permission UX. Reading the state before requesting a position lets the application branch on three real outcomes — already granted, already denied, or not yet asked — without ever triggering a system dialog that the user has not invited.

The three states each map to a different UX path. A granted state means the user has already given express permission, so the geolocation request can go ahead, possibly without a prompt — start the feature immediately, and still handle position-unavailable and timeout errors. A prompt state means that when geolocation is requested, the browser will either ask the user for permission or deny access — show a custom primer that explains the value before triggering the API call, and only call the API after the user taps an explicit affordance. A denied state means the geolocation request will fail silently or return a denied error — do not call the API at all, and surface a manual region picker, a postal code input, or a default-center distance list as the only entry point.

The Permissions Policy response header lets a site control whether embedded frames, including third-party widgets loaded in iframes, can request geolocation; as of November 2026, only Chromium-based browsers honor the header, while Firefox and Safari support the iframe allow attribute but not the header. A site that embeds an analytics widget or a map widget from a third party in an iframe can either allow that origin in the header (Permissions-Policy: geolocation=(self "https://maps.example.com")) and delegate to its iframe with allow="geolocation", or block it entirely (Permissions-Policy: geolocation=()), and the constraint propagates to nested iframes. For sites that handle sensitive flows — registration, checkout, account settings — locking the policy to first-party only is a defense-in-depth practice that, in browsers that honor the header, stops embedded cross-origin frames from requesting location; it does not stop third-party scripts that run in the page's own document.

Always design a manual fallback for the denied path. Reversing a denial takes a trip to the browser or system settings, and the experience must work without it. A search-by-postal-code input, a country and region selector, or a list of nearby results computed from a default center based on IP geolocation all keep the feature usable for users who said no. The denial fallback is not a graceful-degradation nicety — it is the experience every user who declines will get, so treat it as a first-class state from the welcome screen.

Capabilities only native can deliver

CapabilityWebNative iOSNative Android
Foreground one-shot fixGeolocation APICore LocationFused Location Provider
Foreground watch streamwatchPositionCore LocationFused Location Provider
Background location updatesNot availableWhen in Use + background updates; Always to relaunchACCESS_BACKGROUND_LOCATION
Geofence enter/exit triggersNot availableCore Location region monitoringGeofencingClient
iBeacon scanningNot available (Web Bluetooth scanning is flag-only)Core Location iBeacon APIBluetoothLeScanner (or a beacon library)
Headless visit loggingNot availableSignificant Location ChangeActivity Recognition + Geofence
Dwell-time analyticsNot availableVisit MonitoringGeofence + dwell parameter
Wake-on-locationNot availableRegion monitoring wakeGeofence broadcast wake

In the Native Android column, the Fused Location Provider and the geofencing and Activity Recognition APIs are Google Play services APIs (com.google.android.gms), not Android framework APIs; ACCESS_BACKGROUND_LOCATION and BluetoothLeScanner belong to the Android platform.

Background location needs more than a foreground grant on both native platforms. On iOS, an app with When in Use authorization and background location updates enabled keeps running in the background while location services are active; for the system to launch a terminated or not-running app for some types of location updates, the app needs the Always authorization, which Apple says an app obtains by first requesting When in Use and then requesting Always. If an app requests Always while the user has not yet chosen, Core Location uses two prompts before it fully enables Always authorization, and the second appears when Core Location prepares to deliver an event that requires Always authorization. The Apple Core Location authorization documentation is the canonical reference for the iOS authorization model. On Android 10 and later, an app must declare the ACCESS_BACKGROUND_LOCATION permission to request background location at runtime, and Android's guidance is to request it separately from foreground location; for apps targeting Android 11 or higher, the system enforces that and ignores a request for foreground and background location at the same time, and on devices running Android 11 or higher the system dialog has no button for background access — the user sets Allow all the time on a settings page. The privilege bar is high on both platforms, and the user-perceived install friction is correspondingly high — which is the point.

Geofence triggers and iBeacon scanning are two capabilities that genuinely require native. Retail attribution flows that detect a store visit, museum apps that surface an exhibit when a visitor walks into proximity of a beacon, and warehouse applications that route work based on the operator's shelf-level position can depend on these passive, OS-level triggers.

Headless visit logging and dwell-time analytics share the same constraint. The use cases are valid — measuring whether ad spend drove physical store visits, understanding average attraction dwell time at a museum, generating heat maps for venue operators — and they all rely on the OS surfacing periodic location samples to a backgrounded application. Web cannot deliver any of them, and a team that needs them genuinely needs native.

Decision criteria

Foreground location with low-friction acquisition? Web is the right answer in 2026. Store finders, registration region gates, museum and tourism tours behind a QR code, real-estate listings near the user, and one-shot prompts to surface relevant content all live comfortably on the web Geolocation API. On the web, the path from intent to first useful interaction can be as short as two taps — the link, then the permission prompt — while a native install adds store, download, and first-launch steps before the same permission prompt.

Background tracking, geofence triggers, or beacon scanning? Native is required. The gap follows from how the platform is specified — the Geolocation specification delivers position updates only to fully active, visible documents, and, as of November 2026, the web platform has no geofencing API and Web Bluetooth scanning remains behind a Chrome flag — and a feature that needs any of those three needs the OS surface that only native apps can call. Trying to approximate the capability with foreground polling drains battery, breaks when the user backgrounds the tab, and produces unreliable signals that fail the use case.

A hybrid strategy is one workable approach. Start mobile web for first-touch, treat the web experience as the primary entry point, and surface a native install option only after the user crosses a value threshold — they completed a tour, returned for a second visit, signaled they want push notifications about new content, or asked for a feature that requires background context. The install becomes a value-driven choice rather than a permission demand, and the prompt arrives when the user has a reason to accept it.

Avoid premature native. The friction cost of a native install can be higher than the capability gap the install closes for first-touch use cases. Teams that build a native app first, ask users to install it before they have seen the value, and only then surface a location feature behind that wall put an install step in front of the feature that a mobile web version does not have. The opportunity cost is the audience that bounces at the install step. The mobile-web article on this topic covers the no-app surface in detail and is the companion to this guide for the foreground half of the decision.

Treat web and native as the same continuum rather than as competing platforms. One workable architecture for product teams is a mobile web entry point that reaches the broadest audience, plus a native shell that serves the smaller population of repeat or background-context users with the deeper capability set. The capability map above is the contract — read it before deciding which side of the continuum a new feature lives on.

What to evaluate when picking the surface

  • Catalog the location capability the feature actually needs — foreground-only, background, geofence, beacon, dwell-time
  • Default to mobile web for any feature whose capability sits in the foreground row
  • Estimate the first-touch funnel for both surfaces — web can be as short as two taps, while native adds store, download, and first-launch steps
  • If the feature needs background context, scope native install to users who have already engaged rather than asking on first visit
  • Read the Permissions API state before requesting position on web — branch the UX on granted, prompt, and denied
  • Design the manual region picker for the denied path as a first-class entry point, not a fallback after a denial
  • Test iOS PWA permission persistence with a forced cold start — do not assume Android persistence predicts iOS behavior
  • If shipping Web Push to iOS users, design the Add to Home Screen prompt timing first — iOS Web Push (16.4+, March 2023) requires the install
  • Lock Permissions-Policy: geolocation to first-party origins on sensitive flows — registration, checkout, account settings — and leave allow="geolocation" off third-party iframes there, since only Chromium-based browsers honor the header (as of November 2026)
Project Inquiry