Where to store the data of the mobile app? | IT Depends

00:00 → 00:04

The mobile application data is like the glue that connects all its functions.

00:04 → 00:08

But what's the best way to store them? Well, it depends.

00:13 → 00:15

We can store our data in two ways,

00:15 → 00:19

locally on the device or externally on the server.

00:19 → 00:23

But the truth is there are very few applications that only use one solution.

00:23 → 00:27

Let's consider where to store the data depending on its type.

00:27 → 00:30

Data necessary for the functioning of our application.

00:30 → 00:33

There are many questions that we need to ask ourselves first

00:33 → 00:35

before making a great decision.

00:35 → 00:38

Do you want your application to be partially functional when

00:38 → 00:40

user loses reception?

00:40 → 00:43

Or how is the service supposed to know that the user is logged in?

00:43 → 00:47

Should an application reset the settings each time it's opened?

00:47 → 00:48

Looking at these examples,

00:48 → 00:52

we can think about the storage of authentication tokens,

00:52 → 00:55

user preferences, or caching the necessary data.

00:55 → 01:00

These are not all types of data and not every application needs all of them.

01:00 → 01:03

So it's good to consider what is essential for your business.

01:03 → 01:04

Quick access data.

01:04 → 01:09

It's not a secret that locally stored data can be accessed instantly.

01:09 → 01:11

Therefore, when your application needs speed,

01:11 → 01:14

it's best to keep the data on a device.

01:14 → 01:18

Levels in the game or airline tickets are good examples in that case.

01:18 → 01:22

It would be frustrating to wait for the level to load on a bus,

01:22 → 01:25

and imagine the stress of standing in front of the gates

01:25 → 01:28

waiting for the tickets to show up.

01:28 → 01:29

Data that must be available.

01:29 → 01:31

Sometimes it's not about speed,

01:31 → 01:34

but the availability of data itself.

01:34 → 01:37

The worst thing is when the user wants to check something

01:37 → 01:39

important, but can't access it.

01:39 → 01:42

An example would be a contact list or an archive of a text

01:42 → 01:44

chat with someone.

01:44 → 01:47

It would not be practical to keep such things on a server

01:47 → 01:49

and have limited access to them.

01:51 → 01:53

Now let's look at another solution.

01:53 → 01:57

Server data storage would work better in the following scenarios.

01:57 → 01:58

Large amounts of data.

01:58 → 02:02

Although the amount of space on phones increases every year,

02:02 → 02:05

it is still associated with a higher device price.

02:05 → 02:08

Therefore, if we need large amounts of data,

02:08 → 02:11

it's better not to keep them locally where there's probably

02:11 → 02:13

not enough space anyway.

02:13 → 02:17

Perhaps the most famous example of the user's big data is the photo library.

02:17 → 02:20

We can store small thumbnails locally,

02:20 → 02:22

and only when the user selects one of them,

02:22 → 02:26

we download the selected file from the server and display the full version.

02:26 → 02:30

You just have to remember that in this case of storing large

02:30 → 02:31

amounts of data on the server,

02:31 → 02:35

access to them depends on the user's Internet connection.

02:35 → 02:36

Data that must be up to date.

02:36 → 02:40

If you want your application to have the most up to date data,

02:40 → 02:42

you should keep it online.

02:42 → 02:45

In that way, each user will know about every

02:45 → 02:47

changes that are introduced to the database.

02:47 → 02:50

If you operate in the ecommerce industry,

02:50 → 02:52

this solution is tailored to your needs.

02:52 → 02:56

It will let your clients know what things are available for purchase.

02:56 → 02:57

Sensitive data.

02:57 → 03:00

It is a common practice not to store sensitive data unless

03:00 → 03:03

necessary, but if you really need them,

03:03 → 03:06

it's safest to keep them encrypted on a secure server.

03:06 → 03:10

If you don't need to access sensitive data in the offline mode,

03:10 → 03:13

the server is usually a much safer place to store them than

03:13 → 03:14

the user's phone.

03:14 → 03:18

A mobile device can be lost or stolen and so can the

03:18 → 03:19

information stored on it.

03:19 → 03:22

But as I said, unless you really need to,

03:22 → 03:25

don't ask the user for sensitive data.

03:27 → 03:27

As we can see,

03:27 → 03:30

the boundary between the decision of whether storing

03:30 → 03:33

data locally or on the server is very thin.

03:33 → 03:37

It depends heavily on what your application would be used for.

03:37 → 03:41

So it's worth asking yourself a few questions before deciding.

03:41 → 03:43

Should it be kept up to date?

03:43 → 03:45

How large is our data?

03:45 → 03:49

Should the data be available all the time?

03:49 → 03:52

Does the app need quick access to the data?

03:52 → 03:55

Answering them will definitely help in deciding where it's

03:55 → 03:58

best to keep your data.

03:58 → 04:01

Hopefully, explanation of what we mean by it depends in this

04:01 → 04:03

case answers this question.

04:03 → 04:08

Thanks for watching and see you again in the next IT depends episode.

Let's connect and build together