Browse the documentation

Location plugin

2026-11-01· 3 min read· View as Markdown

This plugin lets the standard navigator.geolocation code of your website work inside your app. There's no new API to learn: the code you already use in a browser keeps running. The plugin declares the location permissions, which the app can't use without.

Platforms

Included
  • Android
  • iOS — with the native navigation (Shell V2)

Used by the native builds: Android Build (Native), Android TV and iOS. The Android Build (Web) does not read these settings.

Set it up

  1. Add the plugin

    In your project's plugin library, add Location, then launch a new build.

  2. Ask at the right moment

    The system prompt appears the first time your site asks for a position. Call it from a button, after explaining why.

  3. Declare it in the stores

    Location counts as personal data. Mention it in Data safety on Google Play and App Privacy on the App Store.

Code

navigator.geolocation.getCurrentPosition(
  (position) => {
    const { latitude, longitude } = position.coords;
    showStoresNear(latitude, longitude);
  },
  (error) => showManualSearch(error.message),
  { enableHighAccuracy: true, timeout: 10000 },
);

What it adds to your app

SystemAddedScope
AndroidACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATIONWhile the app is open
iOSNSLocationWhenInUseUsageDescriptionWhile the app is open

Location works while the app is open. Background tracking isn't part of this plugin.

On iOS, Location needs native navigation (Shell V2). Without the plugin, these permissions aren't declared and your site's request fails.

Prompt for AI builders

Prompt for Lovable, Bolt or Base44

On [PAGE], add a button that says why I need the location, then calls navigator.geolocation.getCurrentPosition.

Handle a refusal or an error by showing a manual search. Never ask for the location when the page loads. Use a timeout of 10 seconds.

Replace the value in [BRACKETS].

Frequently asked questions

Does it work in the background?+

No. Location works while the app is open.

Does it use a new JavaScript API?+

No. It's the standard navigator.geolocation of browsers, so the same code works on your website and in the app.

Why do I need to declare location in the stores?+

Google Play and the App Store both ask you to declare the personal data your app accesses, and location is on the list.

A person refused. Can I ask again?+

The system doesn't show the prompt again after a firm refusal. Offer a manual search, and tell them they can allow it in the phone's settings.

See it with your own site

Paste your URL and get a free Android test build on your phone in about 3 minutes.

Publish now

Keep reading