Folder structure of Telegram for Android
App Cache for Cloud Chats
/storage |-- sdcard0 or sdcard1 (depends on phone) | -- Telegram | -- Telegram Images | -- Telegram Documents | -- Telegram Audio | -- Telegram Video
Android Cache for the app
/storage |-- sdcard | -- android | -- data | -- org.telegram.messenger | -- cache
The cache folder is the Android Cache folder for Telegram.
Manually Saved Images
/storage |-- sdcard | -- Pictures | -- Telegram
This path is used when the user opens an image » taps on "…" » Save to Gallery. A copy of the image is saved into this folder.
In /android/data/org.telegram.messenger/cache (Android Cache) Telegram keeps small avatars, media and file previews, other temporary files, and Secret Chat media and files. The app moves files (images, videos, voice messages, and files) which were received in Cloud Chats to Telegram/<Telegram sub folders>.
Why is it this way? The main reason for having Telegram Images, Videos, etc. folders is because - we users - would like to save all incoming images to the gallery.
Why not in the /android/data/org.telegram.messenger/cache folder? If media scan intent runs, there would be an album called Cache.
Why no sub folder in /android/data/org.telegram.messenger/cache? If we users clear the cache, we will get many non-working images in the gallery.
After moving the files - which is done automatically - it's no longer the "official Android cache", so it's not cleared via Android Settings » Apps » Telegram » Clear Cache. If you delete the cache (Android Settings » Apps » Telegram » Clear Cache), cached profile images and even files from Secret Chats are deleted. In the Secret Chat, we have to manually download each file again from the Telegram Cloud.
Save to Gallery in Telegram Settings
The Telegram app runs media scan intent so the system knows what to do with the files. In other words, Android takes care of the files in its own database. So it knows when an image is or is not allowed to be displayed in the gallery.
- User receives the images yes.jpg, no.jpg, and yes2.jpg.
- User selects Save to Gallery for yes.jpg and yes2.jpg.
In the Gallery, the user will see yes.jpg and yes2.jpg. The gallery will not display no.jpg.
file name = "datacenterId_localId.extension"
File names cannot be changed at the moment. If the file names are changed and the user relogs, Telegram would have to re-download all the files, since it would not know which name belongs to which file.
- If the user deletes the content in Telegram/*, the files will be re-downloaded again if he sees an image or an audio message. This can be prevented by disabling auto-downloads. After disabling auto-downloads, the user can manually remove files with a file explorer.
- Go into Settings - Apps - Telegram - Delete Cache to delete the content of Android/data/org.telegram.messenger/cache
If the user deletes the Cache (Android Settings » Apps » Telegram » Clear Cache), cached profile images and even files from Secret Chats are deleted. In the Secret Chat, the user will have to manually download each file again from the cloud.