Polyfence is in Early Access — APIs and limits may still change. Your feedback shapes what we build.

Polyfence documentation

The geofence layer for your app, your device, and your server. Pick a platform below — install, add a zone, start detecting.

Quickstart

Three peer surfaces — Mobile SDK, Embedded library, Server API. Pick your platform below: install, add a zone, start detecting.

Install the plugin:

terminal
$ flutter pub add polyfence

Initialize, add a zone, start tracking:

main.dart
import 'package:polyfence/polyfence.dart';

await Polyfence.instance.initialize();

final zone = Zone.circle(
  id: 'office',
  name: 'London Office',
  center: PolyfenceLocation(latitude: 51.5074, longitude: -0.1278),
  radius: 200,
);

await Polyfence.instance.addZone(zone);
await Polyfence.instance.startTracking();

// Listen for enter/exit events
Polyfence.instance.onGeofenceEvent((event) {
  print('${event.type} zone: ${event.zone.name}');
});

Source on GitHub: polyfence-core · polyfence-embedded

API reference

Key concepts

Zones
A geographic area (circle or polygon) that triggers events when a device enters or exits. Create via the dashboard, import as GeoJSON, or use the API. No limit on zone count during early access.
On-device detection
On mobile, all geofencing runs on-device using the native Kotlin/Swift engine (polyfence-core). On IoT hardware, the polyfence-embedded C library evaluates coordinates locally. Both paths fire events on the device with no positions sent to Polyfence — use these when you need a strict on-device guarantee. The server-side evaluate API below is the alternative for devices that can’t run the C library.
SmartGPSMobile
The mobile SDK adapts GPS polling based on user activity (walking, driving, stationary) and proximity to zones. Saves battery while keeping detection latency under 50ms.
Embedded / IoTNew
Run geofence checks on ESP32, STM32, Raspberry Pi, or any device with a C11 toolchain. The polyfence-embedded library is under 100KB compiled with zero external dependencies. Sync zones via REST API, evaluate coordinates locally.
Evaluate APIIoT
Server-side point-in-polygon checks for IoT devices that don’t run the C library. Send a device ID and coordinates, get back zone events and current zone membership. Positions are discarded by default, retained only when you opt in to hosted history via the per-account retention toggle (GET /v1/account/retention / PATCH /v1/account/retention). The setting is echoed on every GET /v1/devices/{deviceId} row so your code can mirror it.
API keys
Authenticate REST API calls with an x-api-key header. Keys are scoped ( zones:read, zones:write, zones:delete ) and stored as SHA-256 hashes.
Get API key

Privacy posture

Polyfence applies different defaults to different kinds of data — here’s each.

Positions
Positions are evaluated and discarded — not stored. Hosted history is opt-in per device when you need it (PATCH /v1/account/retention).
Anonymous telemetry
Anonymous platform metrics — never identifiers, never coordinates. One line of code disables it.
Your account info
Standard B2B SaaS PII — email, billing. Identical to what Stripe or Vercel hold about you.

Polyfence collects zero PII and zero identifiable data about your end users. Full breakdown on the privacy page.

Platform support

iOS 14.0+Android API 24+Flutter SDK 3.10+React Native 0.71+ESP-IDF 5.0+Zephyr RTOSLinux (ARM/x86)MIT LicensePrivacy: on-device by default

Ready to start building?

Create your first zone and start integrating Polyfence. Free during early access.