Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I am making application that is using .pls files to read shoutcasts' adresses from them. At one moment I noticed, that sometimes .pls file I was reading data from is disappearing after I have used it.

After lots of testing, I noticed, that if I rename file to .txt, it won't get deleted.

A little more testing, a voila - sometimes, if I read data from one .pls file (pathname provided in String), ALL .pls files on sdcard get deleted! And my doing anything with any of them - they just all get deleted.

I am using HTC Desire Z, Android 2.3.3, not rooted, and I don't remember installing any applications that could be deleting files, especially without my knowledge.

Any ideas? I can provide you with the app code I am using, but I don't really think it is connected in anyway to this problem.

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

Now, I am not 100% that this is the exact issue, as I do know that this is the case with .m3u playlists, but I have not tried using .pls files for a playlist.

The problem sounds like it is with the Media Scanner. When it scans the directory that the .pls file is in, it sees the playlist file (the .pls) but if the directory does not have any other media files in there (like .mp3 for example) then it automatically assumes that the playlist is empty so it deletes it.

You can create a file in the directory called .nomedia and the Media Scanner will not even scan the directory, leaving your .pls files alone.

To test this, you could just drop some type of media file in the directory with the .pls and see if it is still deleted (or add the .nomedia file). If it is not deleted, then it is 100% the Media Scanner causing the files to delete. If it is still deleted, then I would check if in your application you are deleting them some how.

share|improve this answer
    
Ha, and I thought that switching to .m3u files would solve my problem (strangely, they don't get deleted. For now...). I will try adding .nomedia file and do some tests to see if that was the case with .pls files. –  Koger Feb 17 '12 at 15:55
    
Adding .nomedia file to directory with .pls files fixed the problem, thank you very much! –  Koger Feb 17 '12 at 16:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.