# Create and verify a geofence

Create a location and geofence, configure client permissions and registration, and verify enter or exit events in AppPortal.

Source: https://appportal.io/docs/sdks/location

This guide creates a location catalog entry and an attached radial geofence. You need Location
entitlement, permission to configure geofences, and a supported client preview. Use a test location
and device with permission to collect location. A saved server-side geofence alone does not register
an OS geofence or prove background delivery.

## 1. Create the location

Open your app's **Location** area and select the intended environment. In **Location catalog**,
add a location, enter a recognizable name, and select its map coordinate.
You can search for a place or address; verify the pin is where you intend to test.
Save the location.

The location is the reusable place. Its geofences are independent boundaries, so the same store
can have a small arrival boundary and a larger approach boundary.

## 2. Add the boundary

Choose **Add geofence** on that location. Select a radial shape, name it, and set its center
and radius. The dashboard accepts radial bounds from 25 metres to 10 kilometres, displaying feet
when you use imperial measurements. Choose a reasonable radius for your test's GPS accuracy.

Use **Automatic** when the supported SDK may select it for registration. Use **Application managed**
when your app's business logic chooses whether to monitor it. Tags are optional:
add only tags your application actually uses. Save with **Add geofence**.

**Success:** the catalog lists the new geofence under the intended location with the saved
shape, activation mode, and active state. Reopening it shows the same values.

## 3. Configure the app

Add `AppPortalLocation` on Apple, `io.appportal:location` on Android, the matching .NET
Location capability, or `package:appportal/location.dart` in Flutter.

Initialize the same app credential and deployment as telemetry. Request the OS location permissions
your use case needs, supply the platform's required usage descriptions, and configure background
execution only when your application needs it. OS permissions, AppPortal collection consent, and
server-side geofence configuration are separate requirements.

Sync eligible geofences through the Location SDK. Your application needs a native monitoring
adapter to register boundaries, handle OS callbacks, and record transitions. The current SDK
capabilities do not install those monitors for you. OS limits, proximity selection, activation
mode, and lifecycle state can affect the registered set.
Check the [SDK matrix](https://appportal.io/docs/sdks/compatibility) before relying on background behavior.

## 4. Verify a transition

Start outside the test boundary, move inside it using a permitted device test or emulator location
simulation, and inspect **Location → Events** in the same environment and time range.
Then test exit. Account for GPS accuracy and any configured dwell/cooldown settings.

**Success:** the expected enter/exit event appears for the geofence and test subject with a plausible
timestamp. A map pin moving is not, by itself, evidence of a geofence transition.
Repeat in the foreground and in the background if your application needs both.

If no event appears, check OS permission, actual registration, activation mode, active state,
accuracy/confidence, cooldowns, connectivity, and the selected filters.
Do not label stale last-known coordinates as current movement.

## Connect location to a workflow

The [.NET geofence planning prototype](https://appportal.io/docs/sdks/dotnet/geofencing) selects nearby fences using
your app's place and group metadata. Filter by location attributes, match your own location IDs,
and add check-in windows. App rules stay in your code; native registration is a separate step.

Use [tags and cooldown policies](https://appportal.io/docs/concepts/locations-geofences-and-tags) for shared transition
rules, then verify the event before using it in an audience. Explain the location purpose in your
app and provide appropriate controls. Access to individual positions is role-gated and audited.

Agents can use [MCP geofence previews](https://appportal.io/docs/api/mcp-conversations) to propose bounded changes.
Review the exact preview before applying it.
