@woosmap/react-native-plugin-geofencing
v1.0.2
Published
This react-native plugin extends the functionality offered by the Woosmap Geofencing Mobile SDKs. Find more about the Woosmap Geofencing SDK
Readme
Woosmap Geofencing React Native Plugin
SDKs to help developers collecting users’ locations in the right way.
The Woosmap Geofencing SDK is a mobile cross-platform software development kit focused on gathering efficiently the users’ location, triggering events based on region monitoring, and providing categorized users’ zone of interest from geographical and temporal clusters.
The SDK simplifies the integration of the location context in your mobile application by taking care of lower-level functionalities such as data collection or battery management.
Documentation
All feature descriptions and guides to implement the Woosmap Geofencing Android & iOS SDK are available on the Woosmap developers documentation.
If you are looking for the Woosmap Geofencing React Native plugin documentation, we have a dedicated section for it.
Requirements
- React Native
>=0.85.0and React>=19.2.3 - iOS
>=15.1 - Android: JDK 17,
minSdk24,compileSdk/targetSdk36 - Node.js
>=22
Requesting location permissions
WoosmapGeofencing.requestPermissions(background: boolean) asks the user for
location permissions and resolves to one of:
| Return value | Meaning |
|-----------------------|-------------------------------------------------------------|
| GRANTED_BACKGROUND | Foreground and background location are granted. |
| GRANTED_FOREGROUND | Only foreground ("while in use") location is granted. |
| DENIED | The user denied location permission. |
| UNKNOWN | Status could not be determined (e.g. no foreground activity). |
Android: two-step flow for background location
On Android 11+ (API 30+) the system silently denies
ACCESS_BACKGROUND_LOCATION when it is bundled with a foreground location
permission in the same request. Background location must therefore be
requested after foreground has been granted:
import { Platform } from 'react-native';
import WoosmapGeofencing from '@woosmap/react-native-plugin-geofencing';
async function requestBackgroundLocation() {
const first = await WoosmapGeofencing.requestPermissions(true);
if (Platform.OS === 'android' && first === 'GRANTED_FOREGROUND') {
// Second call opens the system "Allow all the time" settings page
// and resolves to GRANTED_BACKGROUND once the user confirms.
return WoosmapGeofencing.requestPermissions(true);
}
return first;
}Notes:
- On iOS a single
requestPermissions(true)call already asks for "Always" authorization; the second call is a no-op there. - On Android 10 (API 29) both foreground and background prompts still appear through the two-step flow — the first call shows the tri-state dialog, the second is skipped because background is already granted.
- If the user selects "Deny" on the background settings page, subsequent
calls resolve to
GRANTED_FOREGROUND. Only a manual change in the system settings can re-enable background location.
