views:

285

answers:

1

I am in need to write an application for Android devices that needs to access a large (~200MB) database. What would be the best way to do this? Can I just stick the database in the assets folder? I have read of various limitations that apply to the entire application size and to individual resources within, especially on some devices... What are exactly these limits?

Is there any way to do this apart from a post-installation download from an external server?

+10  A: 

The G1 has 256MB of internal storage for applications. Even on the Nexus One there's only 512MB so I think it's unlikely that anyone would want a single application taking up such a high proportion of this storage, so creating a 200MB+ .apk file isn't going to be practical.

Your options are probably:

  • Make the database accessible via a webservice so your app can query it over an Internet connection.
  • Download the data bit-by-bit on an as needed basis and cache it on the SD Card.
  • Download the database to the SD Card on the first run of your applicaton.

I think the last of these is least preferable, as a 200MB download is going to take a long time, and might use a significant chunk of someone's 3G monthly data allowance. If you are going to do this it may be worth checking the status of the phone so you only download when there's a wi-fi connection.

Dave Webb
+1 for the webservice suggestion. Worth looking into for this particular case.
Anthony Forloney
If the database is supposed to come with the program, it's probably either specifically for the user or needs to be usable offline, so web services are probably out of the question.+1 for downloading on first run, though. As unfortunate as it is, something that big just needs to be stored on the SD card.
Andrew Koester
The last option is the best, however you don't necessarily have to use your mobile to download it. You may use your desktop and then copy the entire database to the SD card.
dtmilano
For the regular android user, downloading data on an as needed basis is the best option. +1
Austyn Mahoney
One thing that I've seen people do is release the app and a separate "data" download. Basically the user downloads the data APK and runs it once. It then extracts itself to their SDCard allowing the user to free their internal memory, but keeping the whole process Market-based.
fiXedd
Thanks for the suggestions. I would have preferred to avoid extra downloads, but it seems to be unavoidable.
Dnap