1

I am using PlayerPro to play audio on my phone. I want my MP3s to be sorted by creation date and that is the problem. PlayerPro seems to be using MediaStorage's data about media files and it gets the files' creation/update date. But when I add a bunch of files at once to my SDCard and MediaStorage scans it, the creation date of these files is set as it was at the moment of scanning, not the actual file creation date (same applies for file update date). I've managed to write a shell script in attempt to fix it:

su
sqlite3 /data/data/com.android.providers.media/databases/external-90164ef8.db "select _data from files" > /sdcard/log.txt
while read p; do
  STAT=`stat -c%Y "$p"`
  p2="${p//\'/\'\'}"
  QUERY="update files set date_added='$STAT', date_modified='$STAT' where _data like '$p2'"
  echo "$p"
  sqlite3 /data/data/com.android.providers.media/databases/external-90164ef8.db "$QUERY"
done < /sdcard/log.txt
rm /sdcard/log.txt

(it dumps an entire database into log file, then updates every string in database according to file creation date).

The problem is, now I've bought a new phone and I can't root it now, so I need a way to do it without obtaining root.

Is there any way to do so? QuickPic has the ability to fix date (I guess it does the same thing I want to do but for image files), so I guess it is, but I don't know how to do it.

  • The only choice -- for a non rooted device -- I see is to backup com.android.providers.media (MediaProviders) using ADB, then extract the backup and make changes into the database(s), pack the changes back into the backup file and push it into Android to restore the new content. Sounds easy, right! Nope! I can backup that package in my Android 4.2.1 but not in Android 5.0.2, so your Android may be lucky or unlucky here. Find that out. If lucky, not Lucky, then follow android.stackexchange.com/a/28483/96277 – Firelord Oct 8 '15 at 22:42
  • Oh, and don't get surprised if the restore doesn't work or takes effect. It never worked in my cases but this user has had positive result. – Firelord Oct 8 '15 at 22:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.