android - Azure 云存储帐户 Android : Acces blob from android

标签 android azure blob azure-blob-storage

我们正在尝试从 java 客户端应用程序 (Android) 访问 azure blob 存储。 以下教程对此进行了解释:Tutorial Blob Java

从 Eclipse 启动应用程序时出现异常。 “找不到从方法 com.microsoft.windowsazure.services.core.storage.utils.utility.createXMLstreamReaderFromReader 引用的方法 javax.xml.stream.xmlinputfactory.newinstance”。

azure 似乎正在使用 android 中不存在的 XML 库。

下面是代码 fragment :

public static final String storageConnectionString = 
        "DefaultEndpointsProtocol=http;" + 
        "AccountName=myaccountname;" + 
        "AccountKey=myaccountkey";

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    FileOutputStream FileXml = null;
    // Retrieve storage account from connection-string
    try {
        CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString);
        // Create the blob client
        CloudBlobClient blobClient = storageAccount.createCloudBlobClient();
        // Get a reference to a container
        // The container name must be lower case
        CloudBlobContainer container = blobClient.getContainerReference("weetjesandroid");

最佳答案

作为解决方法,您可以使用 Android 的 HttpURLConnection直接访问Blob Service REST API .

阅读Authentication for the Windows Azure Storage Services了解如何提供所需的 Authorization 请求 header 。

您必须编写更多代码并了解如何调用所需的 API,但我可以证明这种方法是有效的。

关于android - Azure 云存储帐户 Android : Acces blob from android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17486532/

相关文章:

java android 字符串和整数函数不起作用

javascript - 无法将 blob 保存到 indexedDB

php - 在 PHP 中从 MySQL 中提取 BLOB 图像数据

android - 如何判断 Android 是否启用了位置检测

android - 当我的应用程序通过任务管理器被终止时如何清除我的 SharedPreferences?

android - RecyclerView 右滑添加图标

azure - 无法将azure sql db连接为VS中CDC控制任务中的连接管理器

c# - 用于函数的 Azure SQL 触发器在空闲后不会触发

azure - 我可以将用户名和密码详细信息存储在 Azure Key Vault 中吗?

mysql - 保存大对象在 hibernate 时花费的时间太长