We have been developing AR solutions for more than 5 years and have completed 30+ projects integrating augmented reality with enterprise systems. One of the frequent tasks is connecting an AR application to external databases.
An AR application for warehouse inventory shows an employee product information right above the physical box. Data is pulled from the ERP in real time. A request latency of 800 ms means the annotation appears after the employee has already looked away. This is not a UX nuance—it's a direct failure of the usage scenario. Integrating AR with external databases requires a different approach to query architecture than regular mobile applications. Our experience shows that standard solutions do not work here.
What Technical Challenges Arise When Integrating AR with a Database?
Latency in AR is more critical than in any other mobile context. The user points the camera at an object and expects an instant response. 300 ms is acceptable, 800 ms is a noticeable delay, 2 seconds makes the app seem broken.
The main sources of latency:
- Network round-trip to the server (100–300 ms on 4G, 20–50 ms on WiFi)
- Server-side query processing time (SQL query without an index on a table of 5 million rows can easily take 500 ms)
- JSON deserialization on the client
The solution is predictive loading and caching. In a warehouse AR app, when the user points at a rack, we know that the next 30 seconds they will be working with that zone. A prefetch requests data for all items in the zone in a single batch request as soon as the rack marker is recognized, storing it in a local cache. When the user points at a specific box, the data is already ready. This approach provides a 2–3 times improvement in response speed compared to individual requests.
Offline mode is the second critical point. In warehouses, industrial workshops, and medical facilities with metal partitions, the signal is unstable. The AR application must work with cached data and synchronize changes when the connection is restored. Merge conflicts (user changes quantity in AR, another user changes the same field in the ERP) are handled via timestamps + last-write-wins or via an explicit conflict resolution UI.
Architecture of the Integration Module
We build on three layers:
Data Access Layer — abstraction over the data source. IProductRepository with methods GetByBarcode(string code), GetByZone(string zoneId), UpdateQuantity(string id, int delta). The concrete implementation can be REST, GraphQL, gRPC, or direct SQLite—the AR logic layer is unaware.
Sync Engine — manages caching and synchronization. SQLite via sqlite-net-pcl on the device as local storage. A background SyncWorker polls the server every N seconds (configurable) or reacts to push via WebSocket/SignalR. Caching strategy – TTL per entity type: fast-changing data (quantity in stock) – 30 seconds, reference data (names, characteristics) – 24 hours.
AR Binding Layer — connects data to AR objects. In AR Foundation: when ARTrackedObjectsChangedEventArgs.added fires, request data for the recognized object via IProductRepository, populate ARAnnotationController with the received data. On removed, hide the annotation and cancel pending requests via CancellationToken.
For performance, we use UniTask (or ValueTask in standard .NET) instead of standard coroutines – fewer allocations, native task cancellation via CancellationToken, proper exception handling in async/await. Microsoft recommends using HttpClient as a singleton to avoid socket exhaustion (see Microsoft recommendations).
Typical Integrations in AR Projects
| Approach | Latency | Complexity | Offline Support |
|---|---|---|---|
| REST API | Medium (100-300 ms) | Low | Requires caching |
| GraphQL | Medium (single request) | Medium | Requires caching |
| WebSocket / SignalR | Low (real-time) | High | Complex, needs queue |
REST API (most common): HttpClient with System.Net.Http, Newtonsoft.Json or System.Text.Json for deserialization. Important: HttpClient must be singleton or pooled – each new HttpClient() opens a new socket pool.
GraphQL: particularly convenient for AR applications – request only the needed fields, get related data in one request. Use graphql-net-client or Strawberry Shake for .NET.
WebSocket / SignalR: for real-time updates – for example, AR annotations on a production line where equipment status changes every second. SignalR Core on the backend, Microsoft.AspNetCore.SignalR.Client on the client.
We do not recommend direct database connections in AR applications – it is an antipattern regarding security (database credentials in the APK) and scalability.
How to Ensure Instant Response?
The key technique is asynchronous prefetching of data in the visible area. We use spatial prefetch: when a zone marker (rack, room) is recognized, we send a batch request for all objects in that zone. This gives a 2–3 times improvement compared to individual requests. UniTask allows cancelling stale requests without allocations. Load testing shows that with 1000+ objects in a zone, 98% of requests are processed in <200 ms.
Step-by-Step Integration Plan
- Data source analysis. We study the API or database structure, determine requirements for data freshness and offline behavior.
- Designing the Data Access Layer. Interfaces, caching strategy, offline policy.
- Developing the Sync Engine. SQLite schema, background synchronization, conflict resolution.
- Integration with AR Foundation. Binding data to tracked objects.
- Testing. Scenarios: poor signal, full offline, synchronization conflicts, load test (1000 objects in view).
| Integration Scale | Estimated Timelines |
|---|---|
| Simple REST + cache (100–500 records) | 1–2 weeks |
| Offline sync + conflicts | 3–5 weeks |
| Real-time WebSocket + complex data schema | 1–3 months |
Cost is determined after analyzing the data structure and synchronization requirements.
What's Included in the Work
- Development of Data Access Layer with REST/GraphQL/WebSocket support.
- Implementation of Sync Engine with caching and conflict resolution.
- Integration with AR Foundation (Unity) or Native XR.
- API and architecture documentation.
- Training your team on working with the module.
- 6-month warranty on identified bugs.
We guarantee that the module will pass load testing with 1000+ objects in view. According to Unity, proper caching reduces latency by 60%.
If you need to integrate AR with external data, contact us for a project assessment. Order a turnkey module development and get a ready solution in 2–12 weeks depending on complexity.
Example of Data Access Layer interface in C#
public interface IProductRepository
{
UniTask<Product> GetByBarcode(string code, CancellationToken ct);
UniTask<IEnumerable<Product>> GetByZone(string zoneId, CancellationToken ct);
UniTask UpdateQuantity(string id, int delta, CancellationToken ct);
}





