I am having very Strange problem with my Samsung Nexus with Android 4.0.2. I wrote a simple program which basically create file each time user presses a button. My program is working great on other devices where as on Galaxy Nexus Windows/Mac can not see those files on SD card, but when i do adb shell i see all files on SD Card.
I retest this on another Nexus which has Android 4.0.4 but still same result.
What could be the reason?
You probably need to index your files via MediaScannerConnection. Quoting myself from a blog post from last year:
...the MTP contents are not based on the literal contents of external storage. Instead, MTP contents are based on what files have been scanned by MediaScannerConnection. If you write a file to external storage, until and unless that file is scanned by MediaScannerConnection, it will not be visible to users over MTP.
External storage is scanned on a reboot and possibly on a periodic basis. Users can manually force a scan via utilities like SDRescan. However, the best answer is for you to use scanFile() on MediaScannerConnection to update the media database after you close your file. This will make your file immediately available to the user.
Related
I have an micro SD card, that was in a Galaxy J5 with Android 7, and all the files are messed up now. (jpg, pdf, mp3)
Following characters can be found in the beginning in all of the files, with minor changes in each one.
<ŕ’Ż4i“µŢî Ś- `6S座uť?ŃÖ0Ü]#Î.0€Ň(QlüŚíď¦îRíb_CONSOLE sżăm:Ń ..
.. and then a lot of NULLs following.
The _CONSOLE part is there in every file. That's why I think that all files were manipulated with the same method.
I am looking for somebody who has seen this kind of files.
I have seen it several times, it appears file based encryption. It is not limited to Android Linux, some NAS devices use it (- eCryptFS file-level encryption).
Seems the OS has written something along the lines of a table into the start of file/a way to read them. I am pretty sure the data is still there, just not visible. Try opening them via a hex editor and check if the NULL's are really null bytes or unreadable data
I had a similar issue. My Galaxy S8 could not longer read the files in the SD card (exFAT) I had encrypted before. I must somehow have deleted the file .MetaEcfsFile that contains the Samsung encryption info. See also here. Btw, the files with the _CONSOLE artifact are encrypted with OpenPGP message format (RFC2440)
My solution was:
Undelete the .MetaEcfsFile with Recuva from a PC using an SD card reader.
Reconnect the Phone via USB cable and copy that file via that connection. Direct copy via SD card reader didn't work. The phone deleted that file again after phone restart.
After the file was copied via cable, the SD card files were still encrypted/unreadable, but...
The phone menu Biometrics and security finally proposed Decrypt SD card and after I started the decryption, I got an error but all my files were decrypted and readable again.
I created an Android app sometime ago. What the app does is basically download a list of files (images and videos) and play them in a loop (like a Playlist).
These files are saved in the default Android External Storage Directory. I get it using this method:
Environment.getExternalStorageDirectory().getAbsolutePath();
Until now I never had storage problems but testing the app on an old device (which has less storage capacity) I realised that I have a problem when the files (PlayList) size is bigger than the device storage capacity.
I have thought (and research) about using an USB stick, but I don't think that would be a good solution since I cannot know 100% sure the USB path (it can be different for each device).
Any ideas about how handle this problem? Maybe another solution instead of using the USB ?
Here is what I have researched:
How to access USB Path in android?
How to find USB storage path programmatically?
android How to write files to a usb memory?
Do you need to store the actual images and videos on the device - why not just store their location and get them dynamically. I've not used a recyclerView but I thought that it could do something like this, but could be wrong.
I am trying to recover deleted photos from android 4.4.2 lg g2's internal storage, As I cannot connect the internal storage as a USB Mass Storage or as an Disk Drive, I cannot run any of the data recovery software.
If there are possibilities to connect as an USB Mass Storage or Disk Drive, or if there is totally different method to achieve this, Please let me know.
Edit : Wondershare Dr.Fone for android seems to be the only software that can scan, but it does not retrieve encrypted Images.
The program that I would use at work to recover deleted files or files from a failing hard drive is called Disk Drill. The one we used was for OS X but it looks like there is also a version from windows.
Although from the years of use I had with it, it was able to recover files that were deleted as long as that part of the disk had not been written over again. It will scan the disk and literally grab every file it can, even things that might be half way deleted or corrupt. If the device was encrypted it might have a more difficult time getting files back. I have not used it on a android devices but I would give it a shot.
Im using a Camera intent to create a picture file in internal storage on android. This picture is saved in the app directory as
/data/data/com.company.app/files/test.png
This works fine, the picture is there.
When I with CCFileUtils then tries to check if the file exists (using js interface):
cc.FileUtils.getInstance().isFileExist("/data/data/com.company.app/files/test.png")
it returns false. Opening the file with CCSprite is totally hopeless too.
The owner and group of the app is the same as the app itself(i.e. "com.company.app"). The read/write permissions of my file is rw-rw-r.
EDIT: Adding information to add information.
The device from which I've extracted the information is a rooted Samsung Galaxy S running Cyanogenmod 11(exact build number: 11-2014112-SNAPSHOT-M12-galaxysmtd) which is built on top of android version 4.4.4.
Its internal storage so its the device own storage. That means it can't be on a sdcard if Im correct, im not sure, but its not removable media anyhow and its not in a sdcard folder on the device.
I've also tried to do the same on a 1+ one running CM11(exact build number: 11.0-XNPH44S). This device is not rooted so I can't check it's filesystem. But it seems to handle it the same way.
The Problem
My app supports 4.0+ and it is all about file handling. It works perfectly in all Android versions except Kitkat.
In Kitkat, my app is unable to modify or write any files in SD card. But I see various apps like,
1) Solid Explorer
2) ES File Explorer
3) CamScanner
4) UC Browser
All of these apps give write access to SD card even in Kitkat devices without even root access.
Requirements
I need to have a fully functional way to create or modify files stored in the SD card in Kitkat. I seems to have troubles a lot of users and a proper solution will help many developers like me.
Yeah I came across that problem as well. After a lot of reading across the web the solution is to write only in your app folder (Ex: /sdcard/Android/data/packagename).
About those apps, on my s4 mini, es explorer cannot delete from external sdcard, so I think is different from device to device.
If the devices is routed change the permissions to gain write access anywhere on the sdcard.