Create a Service
important
This tutorial assumes you are using windows and can run the Universal Windows Version of Geocortex Mobile.
Sometimes, you may have logic or data that needs to be shared by multiple components across an app. In Geocortex Mobile, services are shared singletons that can register global commands and operations, be injected into components, run background tasks, and more.
Prerequisites
Check out and setup the Geocortex Mobile SDK Quickstart project.
Basic Service
Create a new file services/CustomService.cs
under the platform agnostic project.
In the file, add a new service class CustomService
and register it with Geocortex Mobile using an assembly attribute.
Create a Custom Command
Custom Services can register custom commands and operations. The following example shows how a custom service can register a command with the Operations Registry
, and how that command can be configured to run on a button press using layout and app config.
- Service
- Layout
- App Config
- User Interface
Relevant SDK Samples
Check out the relevant Geocortex Mobile SDK Samples:
Next Steps
Learn More About Services
Take a deep dive into services in the Geocortex Mobile SDK
Build a Service that Manages Dynamic Data
Built a service that manages a dynamic data source and exposes it to components