Home > other >  Import pictures from azure IoT-hub to Xamarin app
Import pictures from azure IoT-hub to Xamarin app

Time:11-19

Is it possible to download pictures from an Azure IoT hub to my Xamarin app?

I want to take pictures on a raspberry device, send them to the IoT hub and then send them to the Xamarin app. If you know another way to do this, please let me know!

Thanks

CodePudding user response:

Azure IoT Hub supports file uploading, to do this, you associate a storage account to your IoT Hub. After that, you device can request a file upload URI and upload the file (an image in your case). After the upload is complete, the device should send a notification to IoT Hub that the upload is done (or has failed). You can then receive this notification using the Service SDK.

Here is an example of a notification (from the docs):

{
    "deviceId":"mydevice",
    "blobUri":"https://contosostorageaccount.blob.core.windows.net/device-upload-container/mydevice/myfile.txt",
    "blobName":"mydevice/myfile.txt",
    "lastUpdatedTime":"2021-07-31T00:26:50 00:00",
    "blobSizeInBytes":11,
    "enqueuedTimeUtc":"2021-07-31T00:26:51.5134008Z"
}

Your Xamarin app can use that blobUri to download and show the picture. It will grab it directly from the storage account, and will not go through IoT Hub.

This entire process is documented here, and there are examples available that showcase the scenario.

  • Related