Azure IoT Hub Integration in Mobile IoT App

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Azure IoT Hub Integration in Mobile IoT App
Medium
~3-5 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1052
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Azure IoT Hub Integration in Mobile IoT Applications

Azure IoT Hub differs from AWS IoT Core mainly in authentication model and protocols. No MQTT over WebSocket via SigV4 — instead SAS tokens (Shared Access Signatures) or X.509. For mobile apps this means different strategy: don't give user SAS Connection String, generate short-lived SAS tokens on backend.

Authentication via SAS Tokens

SAS Connection String (HostName=...;SharedAccessKeyName=...;SharedAccessKey=...) — root credentials equivalent. Never embed in mobile app. Solution — backend proxy: user authenticates in your system, backend generates SAS token with limited lifetime (8–24 hours) for specific device ID and returns to client.

Token generation on Node.js:

const crypto = require('crypto');
function generateSasToken(resourceUri, signingKey, expiresInMins) {
  const expiry = Math.ceil(Date.now() / 1000 + expiresInMins * 60);
  const stringToSign = `${encodeURIComponent(resourceUri)}\n${expiry}`;
  const hmac = crypto.createHmac('sha256', Buffer.from(signingKey, 'base64'));
  const signature = hmac.update(stringToSign).digest('base64');
  return `SharedAccessSignature sr=${encodeURIComponent(resourceUri)}&sig=${encodeURIComponent(signature)}&se=${expiry}`;
}

Mobile client gets this token and connects to IoT Hub via AMQP over WebSocket or MQTT. On Flutter use mqtt_client with SAS token in password field. On React Native — azure-iot-device npm package via react-native-tcp-socket or AMQP via rhea (AMQP 1.0).

Cloud-to-Device and Device-to-Cloud Messages

IoT Hub supports several messaging patterns:

Device-to-Cloud (D2C) — telemetry from device to hub. Mobile app as "virtual device" publishes commands via D2C. Limit: 256 KB per message, max 8000 messages/day on free tier.

Cloud-to-Device (C2D) — commands from cloud to device. Use for push commands: backend sends C2D to specific deviceId, device receives and executes. Delivery acknowledgment — positive/negative/none.

Direct Methods — synchronous request-response with timeout (1–300 sec). Ideal for commands needing confirmation: "set temperature 22°C" → response from device with status. Called from mobile via REST API: POST /twins/{deviceId}/methods.

Device Twin

Analog of AWS Device Shadow — Device Twin. Stores desired and reported properties. For mobile — main way to read current device state without persistent MQTT: GET /twins/{deviceId} via IoT Hub REST API with Bearer token.

Typical mistake: accessing Device Twin directly from mobile, passing IoT Hub connection string. Correct — via own API layer, proxying requests and verifying user's device access rights.

Azure Notification Hubs for Push

Push by IoT events — via Azure Event Grid + Azure Function + Azure Notification Hubs. Event Grid subscribes to IoT Hub events (Microsoft.Devices.DeviceTelemetry), triggers Function, Function sends push via Notification Hubs to FCM/APNs.

On Flutter integrate via firebase_messaging (for FCM) — Azure Notification Hubs manages registration and targeting, delegates delivery to FCM/APNs. Tagging registrations by userId lets send push to specific user without token storage on IoT backend.

Timeline

Basic integration (SAS tokens, MQTT/AMQP connection, Device Twin) — 2–3 weeks. Direct Methods, Event Grid, push notifications — additional 2 weeks. Pricing depends on device count, IoT Hub tier, and required message frequency.