2
votes

I'm currently using Azure for a project. In this project I hava a Android Application and a IoT(NodeMCU 1.0) and I have found a way to send messages from the IoT Device to my android application using Azure, but now I have to send data from the Android application to the IoT device. the device is using IoT Hub to send information to Azure.

3
How did you send data from mobile app to cloud? Any link?AskMe

3 Answers

0
votes

You could use IoT REST API to send a command to device from your android application. Refer https://www.codeproject.com/Articles/1113447/Azure-IOT-Hub-REST-API for more details.

Another reference: https://microsoft.github.io/techcasestudies/iot/2016/11/29/Agatsa.html

0
votes

According to your description, based on my understanding, I think you want to send data from Android app to IoT device via the way of sending cloud-to-device messages of Azure IoTHub. You need to do two steps for implementing the needs.

First of all, there are two ways to implement for sending a cloud-to-device message to IoTHub.

  1. Directly sending data from Android App to IoTHub, you can refer to the section Send a cloud-to-device message of the offical tutorial for Java to do it, but I think it's not a good idea to do it between Android and IoTHub that considering the concurrency requests for IoTHub come from android devices installed your app.

  2. So per my experience, the better way is that create a Mobile App for Node.js which will handle the request from Android devices and forward the data to IoTHub via Send a cloud-to-device message using Node.js.

Then, you can try to call the REST API Receive Device Bound Notification using eLua or Arduino ino code at regular intervals on IoT devices to receive the c2d message, like the code in the section Receive messages in the simulated device app.

Hope it helps.

0
votes

If you have to send data from Android device to Azure IoT Hub then please follow following Microsoft Articles

  1. Quickstart: Control a device connected to an IoT hub (Android)
  2. Quickstart: Send IoT telemetry from an Android device