Sending Location Data to Device Cloud in C
A client application can send geolocation data to Device Cloud using the location APIs to monitor the device location.
To transmit location data, you create and register a telemetry object, create a location data sample, and specify the location data sample as the telemetry value when you publish the telemetry.
You need a wireless network adapter or GPS antenna and the associated drivers that are compatible with your board. For more information about the supported boards and hardware, see the information for the supported operating systems.
If you use a wireless network for location data, you need software libraries on your device to access geolocation data from a service provider, such as Google. Depending on your service provider, you may need a commercial subscription.
You must have previously initialized your application (see Initializing Your C Application).
Before you run your application, the thing definition that corresponds to your application must be defined.
To send data to Device Cloud, the application must be connected to Device Cloud.
Examples
The iot-app-simple-location sample application provided with the agent shows example code for sending location data to Device Cloud with all attributes specified.
If you do not need the location data sample and the telemetry object after you send the location data, call the iot_location_free, iot_telemetry_deregister, and iot_telemetry_free functions to free the associated memory.