Challenge: Use External Storage
Saving files on internal storage is the right choice for most applications, especially when data privacy is a concern. Some apps, however, might want to write to the device’s external storage if it is available. This can be useful if you are storing data that you want to share with other apps or the user, like music, photos or downloads from the web. External storage is almost always more plentiful, too, which makes it the right choice for large media like videos.
To write to external storage, you need to do two things. First, check to ensure that the external storage is available. The android.os.Environment class has several helpful methods and constants that you can use to determine this. Second, get a handle ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access