Closed hallahan closed 8 years ago
For future reference, here's how we can resume downloads that have been stopped:
http://stackoverflow.com/questions/6237079/resume-http-file-download-in-java
Initial sprint will not include this.
I'm thinking we might want to use DownloadManager instead:
http://developer.android.com/reference/android/app/DownloadManager.html
http://blog.vogella.com/2011/06/14/android-downloadmanager-example/ http://www.mysamplecode.com/2012/09/android-downloadmanager-example.html http://www.programcreek.com/java-api-examples/index.php?api=android.app.DownloadManager http://www.compiletimeerror.com/2013/11/download-manager-in-android-with-example.html#.VRH7aZPF8Wc
After digging into DownloadManager - an excellent tool that does everything we need, there is one crucial part that it is missing. It does not do HTTP POSTs. Only HTTP GET. The usage of Overpass I am used to for getting data is via a POST. Two options are now:
Overpass API accepts GET requests just fine:
http://overpass-api.de/command_line.html
Looks like Apache can accept very long URLs (8190 bytes). I'm going to assume that Overpass will be fine as well. The URL limitation is a browser thing, which we don't have to worry about.
http://stackoverflow.com/questions/1289585/what-is-apaches-maximum-url-length
Worked out an example showing how to dow downloads via Overpass:
Asked the Overpass folks why we aren't getting the file size in a response:
This is awesome. The UI needs a little cleanup, I think you need something that confirms the user wants to get the osm for the bounding box. I would also have something similar to the overpass API that warns of large downloads, say over 2mb.
Based on some user tests this needs a confirm dialog. Users end up with lots of extraneous osm files on the phone. This would also be made better by tying the UI to issue #51
We should have UI on the android phone to download OSM XML dynamically from the Overpass API:
This can be used instead of doing this:
https://github.com/AmericanRedCross/openmapkit/wiki/OSM-Data-from-the-Overpass-API