简体   繁体   English

使用脱机同步将图像从Android设备上传到Azure Blob存储

[英]Upload images to Azure Blob Storage from an Android device With Offline Sync

From My android Application want to Capture a Image ,With a Text Field. 从我的Android应用程序想要捕获一个带有文本字段的图像。

Text fields Data need to Save In Local Sqlite Database(Like TodoItem Table) ,Image will Save in Sdcard With Offline. 文本字段数据需要保存在本地Sqlite数据库(如TodoItem表)中,图像将离线保存在Sdcard中。

When Internet Comes Image Need to Sync in Azure Blob Storage , Text data need to Sync in Azure Todoitem Server Table. 当Internet出现图像需要在Azure Blob存储中同步时文本数据需要在Azure Todoitem服务器表中同步。

I tried Below Links, for Offline Data Sync is Working. 我尝试了以下链接,因为脱机数据同步正在工作。 But Offline Image Upload to Azure not able to find Any code or Link . 但是,将脱机映像上传到Azure无法找到任何代码或链接

Please help me to Find the solution 请帮我找到解决方案

Link I tried for Image Upload to Azure Online Mode 我尝试将图像上传到Azure联机模式的链接

Offline Data Sync 离线数据同步

This is not possible in todays Android SDK. 在当今的Android SDK中这是不可能的。 As a result, you will end up rolling your own offline sync for images. 结果,您最终将滚动自己的图像离线同步。 Sync logic for static stuff tends to be easy - you read the file list from the SD, generate an API for the server that reads the list from blob or (more appropriately) Azure File Storage and compare the two. 静态内容的同步逻辑通常很容易-您可以从SD读取文件列表,为服务器生成一个API,该API从blob或(更合适的) Azure文件存储中读取列表,然后将两者进行比较。 Since your list is static, you can download files that are not on the SD card and upload files that are not on the server. 由于列表是静态的,因此您可以下载SD卡上没有的文件,也可以上传服务器上没有的文件。

There are two issues you need to deal with if your files are not static. 如果文件不是静态的,则需要处理两个问题。 First is updates - generally, files tend to deal with "latest file wins" so you can check and compare the last write timestamp. 首先是更新-通常,文件倾向于处理“最新文件获胜”,因此您可以检查并比较上次写入时间戳。 The second is "deleted files". 第二个是“已删除文件”。 If you do "deleted files", you will need to create a sync table for the file list (and the Azure Mobile Apps SDK will help you there) - then check your SD card after the sync for files that are on the SD card but not in the table - those should be removed. 如果您执行“已删除文件”,则需要为文件列表创建一个同步表(Azure Mobile Apps SDK将为您提供帮助)-然后在同步后检查SD卡中SD卡上的文件,但不在表格中-应该将其删除。

The Azure Mobile Apps SDK always contained support for online/offline sync of data, but was recently updated to include support for files . Azure移动应用程序SDK始终包含对数据的联机/脱机同步的支持,但最近已更新为包括对文件的支持 To see how to add offline file sync to your iOS, Android, and Windows 10 apps , check out the linked post. 要查看如何将离线文件同步添加到iOS,Android和Windows 10应用程序 ,请查看链接的文章。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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