update tiles if outdated (use lastModified tag and only update on wifi)

This commit is contained in:
Philipp Schaefer
2013-12-21 18:39:50 +01:00
parent 8f5072dda5
commit c624a789d5
3 changed files with 8 additions and 3 deletions

View File

@ -37,9 +37,11 @@ public class DownloadTile extends AsyncTask<String, Void, Boolean> {
try {
tileUrl = new URL(urls[0]);
conn = tileUrl.openConnection();
File file = new File(mFilePath, mFileName);
// update tile if needed, else return
if (conn.getLastModified() < file.lastModified()) return true;
InputStream is = null;
is = conn.getInputStream();
File file = new File(mFilePath, mFileName);
Log.d("iitcm", "writing to file: " + file.toString());
File output = writeTileToFile(is, file, mFilePath);
} catch (IOException e) {