简体   繁体   中英

How can I verify that a file was completely downloaded in android?

I have a reference application that downloads an sql lite file in the beginning to use to reference the data. I need to have a way to verify if the file has downloaded completely. I was saving the file length after the file downloads and putting it into preferences and checking against the actual file at the start of the application. I'm adding tables and other data to the database now and cannot use that method. What do I use?

Unless the download fails (= throws an exception) you can assume that the file is downloaded fully if you are downloading the file yourself in your own code. If something goes wrong (an exception of some sort it thrown) you will have to react by retrying or whatever..

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