How to instantly back up large amount of data of android phone using an app?

Trying to create a replica of an app that after getting installed will recover user deleted data (i.e images and videos) and these data can be recovered only if the user deletes them after an app is installed.

So it is not using file system but creating backup of data but problem is that app instantly after installation recovers data(if the user deletes something right after installation data will recover).

So the question is how the app is creating back up instantly of a huge amount of data or is it applying some other method?