Android save app settings/data in Internal/External Storage
Asked Answered
T

1

2

I need a little help with understanding what can I do and cannot in android. I'm working on application which needs to ask user in first start to select a device (internal/external storage) where to save the data which my application is downloading over internet. So I'm trying to find answer for a few questions about this issue :

  1. Is there any limit for data in internal/external storage in Android for a single application.
  2. Can I set the directory of sqlite database which my app is using and If I can, is it a good practice or not.
  3. What should I consider when user decide to change the destination of application's data from internal to external storage. Should I create all the folders and etc. again or Android platform is doing it automatically?

Thanks in advance!

Tramp answered 14/11, 2011 at 8:47 Comment(0)
N
1
  1. Your limit on external storage(SDCARD) is determined only by its capacity, I'm not sure about the internal storage, maybe it's the same situation.
  2. You can extend SQLiteOpenHelper and create your own DB adapter, which will manage your database and store it on SD card or /data/databases directory. I think that it's better not to place database on SDCARD, because any other app can access it there. On the other hand, /data/ folder is private.
  3. It's tricky thing. You should be careful while copying data. Check whether directory of file exist, before writing into them. It's better to explicitly create all files and directories before trying to write to them.

Here is a good example of Database Helper for accessing database. You can modify it so it can use both external and internal storage.

Nacelle answered 14/11, 2011 at 8:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.