简体   繁体   中英

How do I upload a file with the Azure IoT Device sdk

I'm trying to use the Java Azure IoT device client sdk (v1.2.28) to upload files to blob storage. The examples show how to do this with the .net sdk but it seems like the same methods in the DeviceClient class don't exist in the java sdk. Is it not possible yet with the java sdk?

https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-csharp-csharp-file-upload

I reviewed the javadocs of Azure IoT device SDK, as you said, there is not a method to upload file to blob storage.

Accoring to the document File uploads with IoT Hub and the related REST API Create File Upload Sas Uri , the feature is required the blob sas uri, so only using IoT device SDK for Java is not possible, you need to use Azure Storage Java SDK to generate a blob sas uri first to call the REST API to do it.

However, for the other feature to receive file upload notification, there are some classes of Azure IoT service SDK for Java to support, which include FileUploadNotification , FileUploadNotificationReceiver , etc.

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