views:

46

answers:

2

I am creating an Android application which will have some embedded music inside of it ( ~ 80 MB ). I was planning on putting it in the res/raw folder.

Since android stores that all in it's internal memory, is this way too large? What are my options? I have come up with the following:

  1. Copy resources out of internal storage and onto the SD card when application first starts. Afterwards remove from internal storage (is this possible?)
  2. Download music from the web when the application first starts.

I would really prefer not to have to go with option 2 since I want the app to be entirely offline and the static music is not going to change (except between releases).

Any other ideas?

A: 

Number 2 is the only option, 80Mb is enormous size for android application.

Konstantin Burov
+2  A: 

Hi,

Number 1 is not a valid option, an application package (.apk) with the music in the raw will weight around 80Mb. An Android user will not download an application that is 80Mb size (if there is enough memory free to install it).

You should use option 2. Downloading the data in background and storing in the sd card as cache. So the next time your app start you don’t need to download it again.

BTW: Use the function android.os.Environment.getExternalStorageDirectory() to get a directory in the sdcard.

Best,

fpanizza
and then compensate appropriately if the device is a samsung galaxay, because that gives you the parent of *two* storage directories
Chris Stratton
what if the user uninstalls the application though? won't the 80mb still be hanging around in the SD card taking up unnec. space?
binnyb
Yes, but if you store the files in “/Android/data/<package_name>/files/” path, it seems that the files will be deleted on uninstall. It's better explained here: http://developer.android.com/guide/topics/data/data-storage.html#filesExternal .
fpanizza