Real-time apps consume data that is updated frequently in order to show its current (or nearly current) state. Such data commonly comes from GPS and other sensors to provide location and attribute updates. You might get such data by refreshing a map or layer that is frequently updated (such as a precipitation radar image, for example) or you might connect to a data stream that provides updates to your app (such as the current location and speed of all vehicles in your fleet). Once established, a connection to a data stream can continue to deliver updates until the stream connection is closed.
Some common use cases for real-time apps include:
- Utilities—Monitor power consumption across the grid to respond quickly to changes in demand or outages.
- Public safety—Monitor the latest status of responders in the area to determine who are best suited to respond to an incoming emergency.
- Environmental—Monitor stream gauges and current weather conditions to assess the risk of floods.
- Transportation—Track vehicles across public transportation routes so riders can anticipate delays.
Real-time apps may receive and interpret updates from a variety of data sources, including stationary sensors such as weather stations, moving assets such as vehicles, or occurring (point-in-time) events like crime and accidents. A real-time app might focus on displaying continuous data for interpretation, such as visually tracking the progress of a storm on the map, or may describe individual geoelements, such as tracking the speed and location of emergency response vehicles.
There are two broad categories of real-time data you can bring into your app: data that is pushed to your app from a connection to a real-time data feed, and data that you pull into your app by proactively requesting updates.
As of version 200.1, real-time data can be pushed to your app by establishing a connection to a data feed. A data feed is a connection to a real-time data source, such as Internet of Things (IoT) platforms, that provide GPS or other sensor data. When a connection to a feed is established, data is streamed to your app from the server. You can handle notification events in your app to work with updates as they are provided by (pushed from) the service. An ArcGIS stream service is an example of a feed that can stream data to your app.
ArcGIS Maps SDKs for Native Apps provide API that abstracts much of the work required to read real-time data coming from a feed and display it dynamically in your app. You can use the API to connect to a supported real-time data source. As data is received, the API will automatically display and update objects created from the stream (dynamic entities) in a layer designed for real-time data. While no other work is required for reading and displaying the data, you can also handle data source events for more fine-grained control of the data updates.
See the Work with dynamic entities topic for more information about connecting to a real-time data feed, displaying real-time data, and working with stream notifications.
You can pull data into your app by proactively requesting data from a source, such as a feature service or other HTTP endpoint. In order to get the most recent updates, your app (or an intermediate service) must periodically request (pull) data. For example, information in this Live stream Gauge layer is updated frequently (an attribute describes the last update time for each gauge) but you must request the most recent data in order to get the updates. When adding such layers to your app, or when authoring a web map, you can set a refresh interval to periodically refresh the layer's data. The frequency with which your app pulls updates depends on the nature of the real-time data and the purpose of your app. This Current Weather and Wind Station Data layer, for example, updates every five minutes.
Bringing data updates into your app this way is a long-established workflow. In addition to adding layers and setting their refresh interval, you can request data updates using a timer in your app that pulls data from any available source at a given interval.