Lecture 7: Storage Intro Flashcards

1
Q

What does internal storage refer to?

A

Non-removable fixed memory within the device

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does external storage refer to?

A

Removable memory like a MicroSD

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What type of storage does android prefer to install?

A

Internal storage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Where can apps specify if theyd like to be installed on external storage?

A

app manifest

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Using internal and external storages impact the way __ is handled

A

file access

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What storage type is used for code and cached data?

A

internal storage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What storage type is used for media, large files and data that needs to be shared?

A

external storage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is App-Specific storage?

A

Storage for data specific to your app that doesn’t need to be shared with other apps

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What permissions do app-specific storage requires?

A

none

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Files can be listed from internal storage using?

A

Array<String> files = context.fileList();</String>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A specific file object can be retrieved from the array?

A

File file = new File(context.getFilesDir(), filename);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is an alternative way to work with app-specific storage if you dont want to work with the file API provided by android?

A

streams

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Explain the special form of app specific storage known as the ‘cache’

A

A place for your app to temporaily store data while in use.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the downside to using cache as temporary storage?

A

It might disappear at any time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Explain the 2 ways a cache can be cleared

A
  • Android automatically empties the cache
  • User manually clears the cache
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How do you access the cache?

A

Create a new cache file
File.createTempFile(filename, null, context.getCacheDir());

Fetch an existing cache file
File cacheFile = new File (context.getCacheDir(), filename);

17
Q

Files stored in the cache are simpled stored within a __ of the normal __ storage and can be otherwise treated as __

A
  • subfolder
  • app specific
  • normal
18
Q

How would you delete an existing file from storage?
Give 2 different ways

A
  • call the delete() method on the File object
    File coolFile = new File(context.getFilesDir(), “file.txt”);
    coolFile.delete();
  • use the context.deleteFile() to delete files based on name
    context.deleteFile(“file.txt”);
19
Q

What storage is an alternative to app-specfic storage?

A

Media storage

20
Q

What is media storage?

A

A form of shared external storage for your application

Typically involved with media (images, video, etc)

21
Q

What are the types of media that media storage stores?

A

Images, video, audio, downloads

22
Q

Android uses a __ style querying system for fetching media

A

SQL

23
Q

When querying media tables you can specify __ to retrieve and ___ clauses with specific requirements

A
  • columns
  • where
24
Q

How do you access individual media files when using media storage?

A

Identify specific files using a query that provides the content uris or file descriptors

Pass them into the openFileDescriptor() method of a ContentResolver()

Try to open file

25
Q

You cannot edit or overwrite files that you do not own. How would you be able to modify a file owned by another application

A

Create a modified copy of the file

26
Q

What are the downsides of using media storage?

A
  • Provides access to all the media storage but little in telling you where to look for a file
  • Owner probably doesnt know the uri of a given file
27
Q

What are the downsides of using media storage?

A
  • Provides access to all the media storage but little in telling you where to look for a file
  • Owner probably doesnt know the uri of a given file
  • Little security, gives read premissions to almost everyone