Develop for mobile devices using Azure IoT SDKs
Things in the Internet of Things may refer to a wide range of devices with varying capability: sensors, microcontrollers, smart devices, industrial gateways, and even mobile devices. A mobile device can be an IoT device, where it is sending device-to-cloud telemetry and managed by the cloud. It can also be the device running a back-end service application, which manages other IoT devices. In both cases, Azure IoT Hub SDKs can be used to develop applications that work for mobile devices.
Develop for native iOS platform
Azure IoT Hub SDKs provide native iOS platform support through Azure IoT Hub C SDK. You can think of it as an iOS SDK that you can incorporate in your Swift or Objective C XCode project. There are two ways to use the C SDK on iOS:
- Use the CocoaPod libraries in XCode project directly.
- Download the source code for C SDK and build for iOS platform following the build instruction for MacOS.
Azure IoT Hub C SDK is written in C99 for maximum portability to various platforms. The porting process involves writing a thin adoption layer for the platform-specific components, which can be found here for iOS. The features in the C SDK can be leveraged on iOS platform, including the Azure IoT Hub primitives supported and SDK-specific features such as retry policy for network reliability. The interface for iOS SDK is also similar to the interface for Azure IoT Hub C SDK.
These documentations walk through how to develop a device application or service application on an iOS device:
- Quickstart: Send telemetry from a device to an IoT hub
- Send messages from the cloud to your device with IoT hub
Develop with Azure IoT Hub CocoaPod libraries
Azure IoT Hub SDKs releases a set of Objective-C CocoaPod libraries for iOS development. To see the latest list of CocoaPod libraries, see CocoaPods for Microsoft Azure IoT. Once the relevant libraries are incorporated into your XCode project, there are two ways to write IoT Hub related code:
Objective C function: If your project is written in Objective-C, you can call APIs from Azure IoT Hub C SDK directly. If your project is written in Swift, you can call
@objc funcbefore creating your function, and proceed to writing all logics related to Azure IoT Hub using C or Objective-C code. A set of samples demonstrating both can be found in the sample repository.
Incorporate C samples: If you have written a C device application, you can reference it directly in your XCode project:
Develop for Android platform
Azure IoT Hub Java SDK supports Android platform. For the specific API version tested, please visit our platform support page for the latest update.
These documentations walk through how to develop a device application or service application on an Android device using Gradle and Android Studio: