简体   繁体   中英

Android studio, reading data from Azure IoT Hub

I am using the java android_sample taken from azure-iot-hub android sample

Basically i have a Raspberry pi that sends data with a python script to the Azure iot hub.

图片关闭设备资源管理器(PI 数据)

As you can see from the picture, the IoT hub is receiving the data.

In Android studio, as said, I am using the android_sample code. I added a button and textview etc... To show the data.

Now, when I go to the "Messages to Device" tab and send data everything works. My phone is receiving that data, and displaying it.

The problem is that I want the data from the "data" tab. When I start the Pi script, and then the android app, it's not receiving the data that the pi is sending.

When I "send" something from the device explorer, it is receiving that data.

if you need some code I will post it, but i'm basically using the example code, just modified a bit.

Your android app can receive data sent from device explorer because these are Cloud-to-Device data. While it can't receive data sent from the Raspberry Pi because these are Device-to-Cloud data. It is expected.

More information you can reference Understand Azure IoT Hub messaging .

For your use case you can reference Device to Device Communication with Azure IoT Hub .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM