[android-developers] External Storage - Android Ice Cream, Galaxy Nexus
I'm updating an app to work with android 4.0.1 and running into a
problem.
The app generates an xml export using the following code (exception
handling removed):
File file = new
File(Environment.getExternalStoragePublicDirectory("XMLExport").toString());
file.mkdirs();
file = new File(
Environment.getExternalStoragePublicDirectory("XMLExport"),
"tag_data.xml"
);
XmlSerializer serializer = Xml.newSerializer();
StringWriter writer = new StringWriter();
serializer.setOutput(writer);
// build up the xml .....
os = new FileOutputStream(file, false);
out = new OutputStreamWriter(os, "UTF8");
out.write(writer.toString());
writer.close();
out.close();
os.close();
With android 2.3 this worked perfectly fine, meaning the file showed
up immediately when the phone was connected via USB and could be read
by a PC or whatever.
With android 4.0.1. The directory and file are written correctly
(verified through astro file manager). But the directory and file are
not visible through MTP when I connect my PC via usb. Only if I power
off/on the phone is the xml file and directory finally visible via usb
MTP. (This behavior is also present if I first generate the directory
and file, no usb connect then connect usb, file is still not present
until I power off/on the phone)
The permissions of the directory and file seem OK according to astro,
i.e. drw and -rw.
What am I missing here?
Regards,
Dean
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home