expo-horizon-location
v0.0.5
Published
A fork of expo-location that provides two implementations: The default expo-location behavior using Google Play Services. A Meta Horizon OS compatible implementation that does not rely on Google Play Services.
Downloads
21
Readme
expo-horizon-location
A fork of expo-location that provides two implementations:
- The default
expo-locationbehavior using Google Play Services. - A Meta Horizon–compatible implementation that does not rely on Google Play Services.
You can choose which implementation to use with the quest / mobile build variants. See expo-horizon-core for more details. This makes it compatible with Meta Horizon devices, while remaining a drop-in replacement for expo-location on Android and iOS.
Prerequisites
- Expo SDK 54 or later (
expopackage version 54.0.13+) - (Recommended)
expo-horizon-corepackage installed. See expo-horizon-core for more details
Usage
- (Recommended) Install and configure the
expo-horizon-corepackage:
npx expo install expo-horizon-coreFor detailed setup steps and configuration options, refer to the expo-horizon-core documentation.
- Install the package:
npx expo install expo-horizon-location
# and remove the old package:
npm uninstall expo-location
# or
yarn remove expo-location- Update your
app.json/app.config.jsto replaceexpo-locationwithexpo-horizon-location. - Use the
questDebug/questReleasebuild variants to run the app on Meta Quest devices. See expo-horizon-core for more details. - Update your imports:
import * as Location from 'expo-horizon-location';Behavior
- On Meta Quest devices → Uses the Meta Horizon–compatible push notification service.
- On standard Android devices → Falls back to the default
expo-locationbehavior using Google Play Services. - On iOS it should have no effect; behavior is always the same as
expo-location.
[!IMPORTANT] The
questbuild variants are intended specifically for Meta Quest devices. Using them on standard Android devices is not recommended, as certain features may be unsupported or behave differently.
Additional features
You might need additional features like isHorizonDevice or isHorizonBuild to check if the device is a Meta Horizon device. See expo-horizon-core for more details.
Features supported on Meta Horizon OS
| Function Name | Android Devices | Horizon OS | Notes |
| ------------------------------------------------------------------------------------------------- | --------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| enableNetworkProviderAsync | ✅ Supported | ✅ Supported | |
| getProviderStatusAsync | ✅ Supported | ✅ Supported | |
| hasServicesEnabledAsync | ✅ Supported | ✅ Supported | |
| requestForegroundPermissionsAsync requestBackgroundPermissionsAsync | ✅ Supported | ✅ Supported | |
| getForegroundPermissionsAsync getBackgroundPermissionsAsync | ✅ Supported | ✅ Supported | |
| getCurrentPositionAsync watchPositionAsync | ✅ Supported | ✅ Supported | The GPS provider is not available on Quest devices. If selected, the network provider will be used instead. Note that, based on experiments, the network provider updates no more frequently than every 10 minutes. |
| getLastKnownPositionAsync | ✅ Supported | ✅ Supported | |
| watchHeadingAsync getHeadingAsync | ✅ Supported | ❌ Not supported | Magnetic and accelerometer sensors are not available on Quest. |
| geocodeAsync reverseGeocodeAsync | ✅ Supported | ❌ Not supported | The Geocoder is not present on Quest. |
| startGeofencingAsync stopGeofencingAsync hasStartedGeofencingAsync | ✅ Supported | ❌ Not supported | Meta Horizon Store doesn't support ACCESS_BACKGROUND_LOCATION Android permission. |
| startLocationUpdatesAsync stopLocationUpdatesAsync hasStartedLocationUpdatesAsync | ✅ Supported | ❌ Not supported | Meta Horizon Store doesn't support ACCESS_BACKGROUND_LOCATION Android permission. |
Version compatibility
Our goal is to align the version numbers of expo-horizon-location and expo-location for easier upgrades. However, since this fork is still under development, we are currently using a separate versioning scheme.
| expo-horizon-location | expo-location |
| ----------------------- | --------------- |
| 0.0.4-0.0.5 | 18.1.17 |
Expo Horizon Location is created by Software Mansion
Since 2012 Software Mansion is a software agency with experience in building web and mobile apps. We are Core React Native Contributors and experts in dealing with all kinds of React Native issues. We can help you build your next dream product – Hire us.
Made by @software-mansion and community 💛
