Android: Hide your application's media files from the Gallery App

If you have a media heavy application it is very likely that you store the image, sound or video data on the sd-card, since it gives you a lot more space than bundling everything with the application. Also, it enables you to dynamically add, remove or modify your media data.


However, the problem that comes with it is, that all your media is public now and can be read by other applications, e.g. the Gallery App, which scans the whole sd-card for image files. To prevent other applications from scanning and displaying your media files, you can simply add an empty file called .nomedia in the root folder of your media data.

From the official Android documentation:
Name of the file signaling the media scanner to ignore media in the containing directory and its subdirectories. Developers should use this to avoid application graphics showing up in the Gallery and likewise prevent application sounds and music from showing up in the Music app. 

4 comments:

  1. Thx. sometimes the solution is nice and easy :)

    ReplyDelete
  2. Thanks Stefan! I always wondered where and how i can customize this. Practically, no big application currently uses this...

    ReplyDelete
  3. A short registration kind will seem the place you’ll have to add in quantity of} particulars, together with your name, email, date of birth, and distinctive password. The table limits are structured to go well https://thekingofdealer.com/pharaoh-casino/ with|swimsuit} both low and high rollers. In addition, El Royale pays players quicker by providing a 24-48hrs hold time on payout requests. New customers are entitled to an enormous welcome bonus, and present customers can use any El Royale promo code to enjoy available promotions.

    ReplyDelete