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 Answers
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
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.
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.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.