My goal is to save data from app in a text file for further analysis. I used the exact code as given here for saving data:
The data is stored and retrieved according to the app, but I am not able to find MySampleFile.txt (even using the search functionality) on the phone.
I can't find it in Android -> data -> com.*.*. I have a Samsung Galaxy S3. Is anything different in this phone?
Should I make any modifications in the phone?
Do the following to be able to see your data stored in the phone's internal memory.
Turn on USB Debugging on your phone.
Connect your phone to the system.
Open DDMS perspective in your Eclipse.
Select your device from the devices tab on the left.
On the right, the last tab will be File Explorer. Open that.
Traverse to data/data/your.app.package to find the data you want to see.
P.S:- NEVER root your phone, unless you're a developer who loves to mess around with the System apps.
To see data, you phone must be root. Samsung Galaxy S3 is not a root from vendor, you need to root your phone to access internal memory/storage, you can only access external memory/storage in your phone i.e. sdcard
But, i would suggest you to use Emulator rather root your phone.
Here, are some links about what is rooting, you can go through these:
http://gizmodo.com/5982287/reasons-to-root-your-android-device
http://lifehacker.com/5789397/the-always-up+to+date-guide-to-rooting-any-android-phone
http://en.wikipedia.org/wiki/Android_rooting
But again I would suggest to use Emulator unless you are not expert enough to root and Install firmwares again when you don't want your phone root.
Please use Emulator to see data->com.package
From Windows Menu->ShowView->Others->android->fileExplorer you can see the file in your device
Specify permission in AndroidManifest.xml:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Related
I have seen many questions about the usb, the host, the permissions, ... I never read a solution.
I have an Android/Windows tablet with a 'big' USB A port. I prefer to use the tablet with Android OS for many reasons. I can connect an Android phone with a standard USB cable. When the connection is made, the application Gallery is automatically running on the tablet and I can see the camera files stored on the phone. And I can only import them with this app.
This is a good feature but I would like to create a small app to copy the files instead of using Gallery. With java, I can have access to paths like dev/bus/usb/xxx but nothing else.
When I use es explorer, I can see the same paths but they are not shown as folders. They are shown as files and, if I select one of them, I get a choice between "open as text file", ...
So, how to have access to the real folders of the phone?
The app Gallery is able to do it. I think we should do the same even if the tablet is not rooted.
If I cannot do it, the only solution for me is using the Windows OS installed on the tablet. It seems it's easier to have access to a device than using Android. That's a bit strange, isn't it? But I prefer to use Android because the system is more appropriate for the tablet which has a small RAM.
Android 6.0 Marshmallow’s introduces Adoptable Storage, a feature that allows use a SD Card as internal storage.
Is it possible to activate adoptable storage via ADB shell commands?
I managed succesfully perform this operation on my LG K8 LTE. I want to notice there are "500 xxx Unknown disk" errors problems, and give solution to avoid this. Solution is very simple.
Proper steps in ADB would be:
adb shell
sm list-disks
// HERE YOU GET YOUR DISK ID, SOMETHING LIKE "disk:179,64" - REMEMBER THOSE NUMBERS
sm set-force-adoptable true
// IN NEXT LINE, SIMPLY PUT THOSE NUMBERS AFTER "disk:" AND ALSO AFTER WORD "mixed" TYPE PERCENTAGE OF SPACE LEFT AS EXTERNAL, SO IN MY CASE:
sm partition disk:179,64 mixed 60
// IT TAKES TIME. BE PATIENT. WITH THIS LINE I TRANSFORMED WHOLE EXTERNAL SD INTO 40% OF INTERNAL AND 60% OF EXTERNAL
sm set-force-adoptable false
BANG! That's it! Now go to storage and usb, there click on internal part of SD and expand options, click on "use as internal" or something like that, last option, (I cannot see what was that because I already clicked it and everything works) apps are finally going on SD with OBB files! ;)
Have a good day!
I have done somewhat extensive research on this question online. I can tell you the steps, and they seem to work for everyone but me. Try them and let me know if they work for you.
Back Up your SD card, as it will be wiped.
If you don't already have it, download and install Java SE Development kit. The website is www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html. I used version 8u101 for Windows x64.
If you don't already have it, download Android SDK Manager. The website is developer.android.com/studio/index.html. Scroll almost to the bottom where it has "Get just the command line tools" and select android-sdk_r24.4.1-windows.zip for Windows. When it downloads, extract all to a location where you want to keep the folder.
Open the Android SDK folder and run the SDK Manager. (If it fails to run, see question 14504325 in stackoverflow). Follow the instructions on www.howtogeek.com/125769/how-to-install-and-use-abd-the-android-debug-bridge-utility/ to get it up-and-running.
When you have the command prompt open per the how-to-geek website instructions, enter "adb shell"
Then enter "sm list-disks". This will return the name of your microSD card. The instructions I was following showed a disk labeled 179:160, but my computer showed the disks as 179,32. This is where I'm stuck.
Finally, enter "sm partition disk:179:160 private", where the numbers are the name of your disk from step 6, if you want to adopt your whole SD card as internal storage. Otherwise, enter "sm partition disk:179:160 mixed 25" where the last number is the percent of the card's space used for external storage. I have not been able to get this to work.
See http://www.modaco.com/news/android/heres-how-to-configure-adoptable-storage-on-your-s7-s7-edge-r1632/ for the original instructions.
P.S. I tried this on a Samsung Galaxy On5, so that might explain why it hasn't worked.
This has now been disabled on (at least) some Samsung tablets.
I have a galaxy tablet that has been running with a huge sd card formatted as internal storage.
I purchased another more recently and on this adb format command did not work (it just immediately returned to the command prompt).
I have had to do a factory reset on the older machine and now find that it too will not allow the SD card to be formatted as internal memory - it behaves just as the newer one does.
My guess would be that Google have updated android to 'respect' the settings of the suppliers UI.
This has (of course) completely messed up my system, as the backup/restore was based on main memory of over 100GB, not the 16GB the device actually has.
I'm working on an android app that writes and reads .PNG files from sdcard. I've already tried it on a device (htc) and it was working fine. Then I had to modify some code to correct some errors (Note that changes made had nothing to do with save/open function). But now just like that I can no longer save/open files on sdcard.
I've tried to open sdcard folder in DDMS File Explorer view (eclipse) but it appears empty and the permissions are d---------. I think it has something to do with the permissions but I have no idea what exactly is causing this problem and how to solve it.
To see if the problem was in my app I tested it on an emulator and it's working fine. So the problem is definitely related to the device.
Any suggestions?
Make sure you didn't connect the phone to your PC in "disk drive" mode.
I recall that in order to be able to view contents of certain directories with ddms you need to have rooted your phone to get the permissions.
What is the difference for installed application's list in device and emulator. In emulator i can see the installed apps in location of /data/app
But, i can't see the installed application on my real device. Where it is stored. I can see the default application from here /system/app But i can't see installed application whatever i downloaded and my own application. Anyone guide me?
On the emulator, you have root access.
On your phone, you do not have root access (unless you root it). And each application gets its own private folder with its own linux userid, so that one application can not look into the folder of another application. This is but only one aspect of the Android security model. There are many more.
Are you looking for anything in particular in those folders? If so, there are workarounds. For instance, if you're trying to look at your sqlite.db file, one workaround is to have your own application (since it has the permission to do so) programmatically read the database file and reconstitute it on the SD card (every time you want to manually check it).
In my device (Samsung Galaxy Tab 10.1, Android 3.1) installed apps are in /data/data.
EDIT: If you want to get absolute path of your directory at runtime, you can use this trick:
getApplicationContext().getFilesDir().getAbsolutePath().replaceFirst("/file.*$", "");
When an Android device is plugged in to a PC (through USB?), is the internal file system mapped to a drive letter on the PC? So that one can copy files to and from the Android under Windows?
And, can Emulator simulate the situation when it's plugged in? How?
Thank you in advance!
Yes, it CAN be mapped to a drive letter. It was much easier with something like a Droid X (Android 2.3), since it would show up as a mass storage device (disconnecting the card from your phone in the meantime), but it's also possible on newer phones such as the LG G3 if you're willing to install 2 free programs, which you probably would like to have anyway.
ES File Explorer - Remote Manager (FTP Server)
First, you need a file manager, not only because the built-in one is useless, but also because you need an FTP server. Install "ES File Explorer" on your Android Device. Then in the options, turn on the "Remote Manager" option, which will activate the FTP server and show you its local address like "192.168.1.3:3721. You can now access your phone as an FTP site from your computer when on your local WiFi network.
Net Drive - Remote Drive Mapping Utility
Next, all you have to do is install NetDrive: http://netdrive.net/ It's freeware and seems to be used by a lot of companies, because it lets you map cloud storage to local drives. That will allow you to map your FTP server on your phone as a local drive.
Don't bother trying to map an FTP site with explorer. First, you may run into a problem that's apparently caused by Chrome, where you can't even add an FTP network location. You'll get an unexpected error telling you the path format is invalid. Interestingly, that is solved by opening the registry editor, then under [HKEY_CLASSES_ROOT\ftp] add a key named "ShellFolder" with string value "{E436EBB6-524F-11CE-9F53-0020AF0BA770}". The error will immediately cease occurring, with no restart or any other action required. Just go back in and add the ftp network location. That, however, still does not allow you to map it to a drive letter, which is why you need NetDrive.
As of Android 4, the wise ones have removed USB Mass Storage support for accessing the internal phone memory. So you no-longer get direct block-access (or a driver letter in windows). You can usually choose on the phone between MTP, or PTP (Media / Photo Transfer protocols) for whichever your OS supports better.
If your device has removable storage it should still support USBMS (with a drive letter) for that partition. At least Android still supports that, but your Manufacturer or Carrier-ware may still fail you here.
However, when it comes to the phone memory, there was a trade-off made in Honeycomb. Unified storage prevents wasted space (no more separate storage for phone / data, and having one fill up first and having confused frustrated users trying to move apps to SD, etc). The trade-off requires that:
Android can no longer ever yield up the storage for the host PC to
molest directly over USB.
Initially for Mac and Linux where support for MTP/PTP has been slower, You can use an FTP app on your phone. But now there is an increasing number of Desktop (PC/Mac/Linux) apps that understand and support the MTP or PTP protocols. You just don't get block access and so you can't get a drive letter without some hackery / third party software.
There have been hacks over the years to make FTP or WebDav or some other protocol work behind a windows drive letter, and something like could still work work for these MTP/PTP protocols, but I have yet to see any such consumer usable software for windows.
If your Linux distro doesn't include MTP support, gMTP seems pretty popular.
You can mount the device via USB but (in Win7 at least) it doesn't appear to have its own drive letter; rather it's treated like a camera or another media device. It doesn't mount automatically; you generally need to "opt-in" in the notification area with something like "Turn on USB storage"
Don't know about emulators.
Using Eclipse you can push and pull files to the emulator using the DDMS perspective. Doing similar on a real device, iirc will require root access to the device, at least to get to the 'sensitive' areas.
The SDK tools will also provide a way of push and pull via the command line.
possible with https://github.com/billziss-gh/sshfs-win
difficult finding good sshservers for android, know that at least one works but doesn't autostart at wifi and have to manually restarted, which it was possible to "come home from work, drive is connected"
this server seams to work fine
https://play.google.com/store/apps/details?id=net.xnano.android.sshserver.tv&hl=en_US
Wanted to backup(incremental) android device using Areca backup utility which requires src and dest to have drive paths.
After trying various methods like adb-sync, Syncthing, webDAV, etc. Got it working with ftp sharing.
Download any ftp server app. I used "WiFi FTP Server" by Medha Apps on Playstore to create a ftp server something like this- ftp://username:*#xxx.xxx.xxx.xxx:yyyy where username can be set in app settings and xxx is i.p. with yyyy as port number.
Map ftp URL to drive path by using free app- "DirectNet Drive"
Use the drive as if it's in your own system, though it will be slow being wireless.