rusty
rusty

Reputation: 11

Android: forcing data/files to be on sd card

I'm a newbie and this is my first post.

I want to create an application that has a lot of static files (html). Due to the size of these html files, when the user install the application, I want to be able to "force" these files to be installed on sd card (external storage). The actual application that will read these files can be installed on built in storage. Where should I put these files? In which folders? I know I can't put them in "assets" or "res/raw" folder because they will be packaged as part of the application and then installed on the built in storage. I would imagine dictionary/spell checker application would implement similar method (the reference data is stored on sd card while the main app is on the built in storage) Thanks.

Upvotes: 1

Views: 1337

Answers (2)

Azu
Azu

Reputation: 322

You can take a look at the android-installLocation attribute in AndroidManifest.xml's root element if you are developing for android version later than 2.2. The mechanism google provided is on an app basis, though.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="yourpackage"
      android:versionCode="yourversion"
      android:versionName="your version name"
      android:installLocation="auto">

The following url for a complete explanation might help you get started. http://developer.android.com/guide/appendix/install-location.html

Upvotes: 3

sat
sat

Reputation: 41076

  1. If you are developing for Android 2.2+, there is an option of pushing your whole app to sdcard.
  2. Another approach is to store all files in server and copy all files from server to sdcard in some location when user launches the app for the first time.

Upvotes: 3

Related Questions