원클릭으로
shiny-locations
GPS tracking, geofence monitoring, and motion activity recognition for .NET MAUI, iOS, and Android using Shiny.Locations
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
GPS tracking, geofence monitoring, and motion activity recognition for .NET MAUI, iOS, and Android using Shiny.Locations
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Guide for implementing Firebase Cloud Messaging push notifications in .NET MAUI apps using Shiny.Push.FirebaseMessaging on iOS and Android.
Generate code using Shiny.DocumentDb.Firestore.Mobile, an on-device (native) Firebase Firestore provider for Shiny.DocumentDb on iOS and Android — offline-first persistence, real-time snapshot listeners, LINQ queries, and managed Firebase Auth identity.
Generate code using Shiny.Extensions.Push, a server-side push notification dispatch library for .NET with a provider-agnostic core and transports for APNs (.p8/ES256), FCM (HTTP v1), Web Push (VAPID + RFC 8291) and WNS (Windows App SDK / Entra auth), plus Shiny.DocumentDb persistence, structured targeting, topics, interceptors, dead-token pruning, multi-app keyed registration, runtime static/dynamic (multi-tenant) configuration via IPushConfigurationProvider, and System.Diagnostics.Metrics + tracing — fully AOT/trim-safe.
Generate code using Shiny.Speech for cross-platform speech-to-text, text-to-speech, audio capture, and audio playback with pluggable cloud providers
Shiny BluetoothLE client/central operations for scanning, connecting, and communicating with BLE peripherals
Generate code for Shiny.AiConversation - a centralized AI service library for .NET MAUI apps with chat client abstraction, wake word detection, speech-to-text/text-to-speech, acknowledgement modes (None/AudioBlip/LessWordy/Full), persistent message store, optional AI chat history lookup tool, and configurable sound effects
| name | shiny-locations |
| description | GPS tracking, geofence monitoring, and motion activity recognition for .NET MAUI, iOS, and Android using Shiny.Locations |
| auto_invoke | true |
| triggers | ["gps","geofence","geofencing","location","position","coordinates","latitude","longitude","distance","tracking","background location","foreground location","GPS delegate","geofence delegate","GpsReading","location AI tools","Shiny.Locations.Extensions.AI","AddLocationAITool","LocationAITools","estimate travel time","GpsRequest","GeofenceRegion","IGpsManager","IGeofenceManager","AddGps","AddGeofencing","motion activity","activity recognition","walking","running","cycling","automotive","stationary","IMotionActivityManager","IMotionActivityDelegate","MotionActivityReading","MotionActivityType","MotionActivityConfidence","AddMotionActivity"] |
GPS tracking, geofence monitoring, and motion activity recognition for .NET MAUI, iOS, and Android applications with full foreground and background support.
Use this skill when the user needs to:
| Property | Value |
|---|---|
| NuGet | Shiny.Locations (MAUI), Shiny.Locations.Blazor (Blazor WASM) |
| Namespace | Shiny.Locations |
| Platforms | iOS, Android, Windows, Blazor WebAssembly (foreground GPS only) |
| DI Namespace | Shiny (extension methods on IServiceCollection) |
| Support Library | Shiny.Support.Locations (provides Position and Distance) |
Register GPS in MauiProgram.cs:
// GPS without a background delegate (foreground only)
services.AddGps();
// GPS with a background delegate
services.AddGps<MyGpsDelegate>();
Register GPS in Program.cs of a Blazor WebAssembly project. Only foreground GPS
is supported - the browser does not expose background location, geofencing, or
significant-location-change APIs. Background modes on a GpsRequest are silently
treated as foreground.
builder.Services.AddGps();
// or with a foreground-only delegate:
builder.Services.AddGps<MyGpsDelegate>();
Geofencing (AddGeofencing, AddGpsDirectGeofencing) is not available in
Shiny.Locations.Blazor. For region-entry behavior on the web, evaluate regions
server-side from GPS reports and notify the client via Shiny.Push.Blazor.
Register geofencing in MauiProgram.cs:
// Standard geofencing with a delegate
services.AddGeofencing<MyGeofenceDelegate>();
// GPS-direct geofencing (uses realtime GPS - battery intensive)
services.AddGpsDirectGeofencing<MyGeofenceDelegate>();
Register motion activity recognition in MauiProgram.cs:
// Motion activity without a background delegate
services.AddMotionActivity();
// Motion activity with a background delegate
services.AddMotionActivity<MyMotionActivityDelegate>();
Platform support: Motion activity is supported on iOS (CMMotionActivityManager) and Android (Google Play Services Activity Recognition). On Android, Google Play Services must be available — the registration silently no-ops if unavailable. Other platforms (Windows, Blazor) are no-ops.
When generating code for Shiny.Locations:
RequestAccess and check the returned AccessState before calling StartListener or StartMonitoring.GpsRequest factories or constructor based on the background mode needed:
GpsRequest.Foreground for foreground-only use (equivalent to new GpsRequest(GpsBackgroundMode.None))new GpsRequest(GpsBackgroundMode.Standard) for standard background (iOS: significant location changes; Android: 3-4 updates/hour)GpsRequest.Realtime(true) for background realtime with precise accuracy (iOS/Android: updates every 1 second)IGpsManager or IGeofenceManager via constructor injection. Never instantiate managers directly.IGpsDelegate for background GPS processing, or subclass the abstract GpsDelegate base class for built-in filtering by distance/time and stationary detection. The GpsDelegate supports minimum filters (MinimumDistance, MinimumTime) that use AND logic when both are set, and maximum filters (MaximumDistance, MaximumTime) that use OR logic and always override minimums when crossed.IGeofenceDelegate for geofence enter/exit events.IMotionActivityDelegate for background motion activity processing. The delegate receives MotionActivityReading with Activity (MotionActivityType), Confidence (MotionActivityConfidence), and Timestamp.Position record with (latitude, longitude) -- latitude range is -90 to 90, longitude range is -180 to 180.Distance factory methods -- Distance.FromMeters(), Distance.FromKilometers(), Distance.FromMiles(). Never construct Distance directly with kilometers unless intentional.GetCurrentPosition(), GetLastReadingOrCurrentPosition(), IsListening(), IsPositionInside(), IsInsideRegion().GpsReadingReceived C# event on IGpsManager (or MotionActivityReadingReceived on IMotionActivityManager) for foreground UI updates. Rx has been removed from Shiny.Locations — use event EventHandler<GpsReading> / event EventHandler<MotionActivityReading> and always unsubscribe on disappear/dispose to avoid leaks. Delegates remain the way to handle readings while the app is backgrounded.GeofenceRegion, always provide a unique Identifier string. The SingleUse parameter removes the region after the first trigger. To register a region idempotently, use the TryStartMonitoring(region, replaceIfExists) extension on IGeofenceManager — it only starts monitoring if a region with the same identifier isn't already being monitored, and (when replaceIfExists is true, the default) stops and restarts an existing region so changed position/notification settings take effect. It returns true when the region already existed, false when it was newly added.IMotionActivityManager via constructor injection for motion activity features. Call RequestAccess() before StartListener(), then subscribe to MotionActivityReadingReceived for foreground updates or register IMotionActivityDelegate for background processing.Task or Task<T>.event EventHandler<T> on the managers (GpsReadingReceived, MotionActivityReadingReceived) — Rx is no longer used in Shiny.Locations.GpsBackgroundMode enum controls background behavior: None (foreground), Standard (periodic), Realtime (continuous).GeofenceState enum values: Unknown, Entered, Exited.AccessState is from Shiny.Core and includes Available, Denied, Disabled, Restricted, NotSupported, Unknown.AccessState before starting GPS or geofence monitoring. Handle Denied and Restricted states gracefully with user-facing messaging.GpsBackgroundMode.Standard over Realtime to conserve battery. Only use Realtime when continuous tracking is required.StopListener() / StopAllMonitoring()).GpsDelegate base class instead of implementing IGpsDelegate directly. It provides MinimumDistance, MinimumTime (AND when both set), MaximumDistance, MaximumTime (OR, overrides minimums) filtering, and stationary detection out of the box.GetCurrentPosition() extension method which handles starting/stopping the listener automatically.GpsReadingReceived / MotionActivityReadingReceived when the view/page is no longer active (pair += with -= on disappear/dispose).NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription in Info.plist.ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION, and ACCESS_BACKGROUND_LOCATION permissions in AndroidManifest.xml.NSMotionUsageDescription to Info.plist when using motion activity recognition.com.google.android.gms.permission.ACTIVITY_RECOGNITION permission and Google Play Services.The optional Shiny.Locations.Extensions.AI package exposes IGpsManager as read-only Microsoft.Extensions.AI tool functions (AIFunctions) for LLM agents — the agent can learn where the user is and reason about distance/time to a destination, but never writes location data. You opt-in via AddGps() (an allow-list you control on behalf of the agent — not an OS permission prompt; location permission must already be granted). AOT-compatible (hand-built schemas, JsonNode results — no reflection).
using Shiny.Locations;
using Shiny.Locations.Extensions.AI;
builder.Services.AddGps(); // registers IGpsManager
builder.Services.AddLocationAITool(); // read-only; there is no write capability for GPS
// resolve the bundle and pass the tools to any IChatClient
var tools = sp.GetRequiredService<LocationAITools>().Tools;
var response = await chatClient.GetResponseAsync(
messages,
new ChatOptions { Tools = [.. tools] }
);
Key types:
AddLocationAITool() — parameterless DI extension. GPS is read-only, so there is no builder or capability to opt-in to; the call registers all three location tools.LocationAITools — resolve from DI; .Tools is IReadOnlyList<AITool>.Generated tools: get_current_location (last cached fix — lat/lng, accuracy, altitude, speed, heading, timestamp), get_distance_to (great-circle distance + compass bearing to a destination lat/lng), estimate_travel_time (mode walking/cycling/transit/driving or a speedKmh override → straight-line ETA).
The tools read the last cached GPS reading; start a listener or ensure a recent fix exists first. Distances and travel times are great-circle (straight-line) estimates — not routed ETAs with roads/traffic — and the tool results say so. Location permission should already be granted before invoking the agent.