If you are running on a non-user build, as of JB you need to require the new read external storage permission. On a user build, you may have enabled this restriction in developer settings.
On Wed, Jul 25, 2012 at 9:43 AM, Alessandro Pellizzari <a...@amiran.it>wrote: > Hi all, > > I am having problems scanning my files on the root of the sdcard, but (it > appears) only on 4.1. > > This is my code: > > public static void scanAll(NotifyScan target) > { > String source = > Environment.getExternalStorageDirectory().getAbsolutePath() > ; > > Log.d("SCANDIR", source); > > scanDir(new File(source)); > } > > private void scanDir(File path) > { > for ( File f:path.listFiles() ) { > Log.d("SCAN", f.getAbsolutePath()); > } > } > > I removed error catching for clarity. > The output is: > > SCANDIR /mnt/sdcard > SCAN /mnt/sdcard/LOST.DIR > SCAN /mnt/sdcard/.android-secure > > But from the File Explorer in DDMS and from adb shell, I get: > > # ls -la /mnt/sdcard > d--------- root root 2012-07-16 11:42 .android_secure > d---rwxr-x system sdcard_rw 2012-07-16 11:42 Alarms > d---rwxr-x system sdcard_rw 2012-07-16 17:06 MyDirectory > d---rwxr-x system sdcard_rw 2012-07-16 11:42 DCIM > d---rwxr-x system sdcard_rw 2012-07-16 11:42 Download > d---rwxr-x system sdcard_rw 2012-07-16 11:42 LOST.DIR > d---rwxr-x system sdcard_rw 2012-07-16 11:42 Movies > d---rwxr-x system sdcard_rw 2012-07-16 11:42 Music > d---rwxr-x system sdcard_rw 2012-07-16 11:42 Notifications > d---rwxr-x system sdcard_rw 2012-07-16 11:42 Pictures > d---rwxr-x system sdcard_rw 2012-07-16 11:42 Podcasts > d---rwxr-x system sdcard_rw 2012-07-16 11:42 Ringtones > > I need to scan every directory on the sdcard and find a certain type of > file. It all worked fine in 2.2 and 2.3. > > What can I do? > > Thank you very much. > > Bye. > > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en