I´m having trouble finding my file in the device
I am saving a file in the external storage, specifically using this code
private function saveFiles():void
{
var file1:File = File.applicationStorageDirectory.resolvePath("v/appstorage.doc")
var file2:File = File.cacheDirectory.resolvePath("v/cache.doc")
var file3:File = File.desktopDirectory.resolvePath("v/desktop.doc")
var file4:File = File.documentsDirectory.resolvePath("v/documents.doc")
var file5:File = File.userDirectory.resolvePath("v/userdir.doc")
saveFile(file1)
saveFile(file2)
saveFile(file3)
saveFile(file4)
saveFile(file5)
}
private function saveFile(file:File):void
{
var stream:FileStream = new FileStream();
stream.open(file, FileMode.WRITE);
stream.writeUTFBytes(body);
stream.close();
}
No file is visible after this when you connect your phone again, I tried killing the app, I tried reconnecting the USB cable, hitting F5 to update the folder.
The files are only visible when I restart my phone, so, my question is:
What can I do to save the file and make it visible when I save the file without restarting my phone?
The file is saved in the folder v you can access those by connecting your phone via USB after the restart, I can see desktop.doc, documents.doc and userdir.doc, the variable body is the string "Hello world" ,
the phones I am using is a Moto G with Lollipop, and an HTC One S with Jelly Bean
And I am using
If someone could please help me with this issue, that would be great!
解决方案
It did happen to me in native language as well, it seems it is related to the MTP cache