Databases

Yogesh Singla
y.reflections
Published in
1 min readMar 19, 2019

How your phone file manager works…

We take our mobile phones for granted for most parts. Using file cleanups to remove “trash”. And using file storage apps on phone without really caring about what’s underneath.

Well ever wondered, how does your phone remember where your photos are located on the internal storage? Turns out it maintains a simple database to do so. A quick search with *.db on your phone should bring out all these file registers, the SQLite databases that map stuff on your phone.

On a Linux terminal you can run the command:

sqlite3 <database_name>.dbsqlite>.tables
sqlite>.schema
sqlite>.help
sqlite>.show

These commands should give you a headstart. A typical image gallery database on the phone has columns (technically attributes) like:

_id INTEGER PRIMARY KEY AUTOINCREMENT, 
_data TEXT,
data_original TEXT,
_size LONG,
_display_name TEXT,
title TEXT,
bucket_id TEXT,
bucket_display_name TEXT,
date_added LONG,
date_modified LONG,
datetaken LONG,
date_recycled LONG,
width INTEGER,
height INTEGER,
mime_type TEXT,
latitude LONG,
longitude LONG,
orientation INTEGER,
audioseek LONG DEFAULT 0,
fullview INTEGER,
group_index INTEGER,
group_id LONG,
camera_refocus INTEGER,
live_photo TEXT,
image_type LONG,
facing INTEGER
using sqlite3 on Ubuntu 18.04

--

--