jeudi 28 janvier 2016

Is it a good idea to use FileObserver to manage the music folder in a Music App

I'm developing an Android Music App. My app will play music from Audio file in SD Card. In the first time app start, app will load all folder which have Audio files and save these data (folder path, folder name in to Folder table, Song path, song name ... into Song table) in Sqlite. I get a trouble, when app is off, user can modify Audio file an when app start, if app read data from Sqlite and play song, the file path may be not correct. I have two solutions :

+Use a Service with FileObserver to manage the folders in Database. But if I use a service, it must be run all the time and I think it's not a good idea (Right ?)

+Everytime user open app, app will check all folder/file in Sqlite, if folder/file is not exist, app will delete these folder/file. I use this way to my app and everytime app start, it need 3s - 4s to loading.

What is better between two ways above ? Or Can you recommend for me a good way to manage audio file in a Music App

Thanks in advanced !

Aucun commentaire:

Enregistrer un commentaire