A couple of users of my SMS Backup & Restore app reported that they were not able to see the backup folder (and files) created by the app when using a Galaxy Nexus on Windows 7. For the uninitiated, Galaxy Nexus is a bit different from most other Android phones, it does not have an SDCard slot and it does not support USB Mass Storage mode when connecting the phone to a computer. Instead, it exposes the internal storage as an MTP device.

Initially I couldn’t reproduce this problem (I have the same phone + OS combination) and thought that this may be a problem on their phone or Windows. I could see the folder and the file on my PC. After some more discussions with the user we came to the conclusion that this looked like some type of caching issue where a file created by my app only appeared on Windows after the phone was restarted.

It turns out that only files known by the MediaStore on the phone gets exposed via MTP to the computer.

A simple work-around/solution for this problem is to let the Media Store know that a new file/folder has been created and that file/folder will immediately appear on Windows.

Doing this in code is very simple, just call the MediaScannerConnection.scanFile method with the full path of the file(s) created.