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.
Related
I am trying to develop a file communication system that interfaces between the respective file systems of a Windows PC and a connected Android device. I realize a better (or at least simpler) way to do this would probably involve using the adb push and pull commands, but I am gathering options/trying to avoid developing additional communications on the Windows side beyond its basic OS file access. I know it is possible to interact with the device's storage directly from Windows when the device is physically connected via USB - if I understand correctly, this is commonly done using MTP? However, I am also currently constrained to only being able to use an emulated Android device. The Android Emulator is a useful tool for a variety of development situations, but I am not sure it was ever intended to appear as an MTP device in Windows like its physical counterparts do.
So could anyone provide documentation or some other resource establishing either
an MTP, UMS, etc. Windows connection is indeed not possible with the default QEMU Android Emulator; or
it is, and how.
Judging by the answer provided here - https://stackoverflow.com/a/21633596/1399272 - it does not appear that accessing the Android file system using a mounted drive in the Windows file system is an option, regardless of whether it is emulated or physically connected. So my question becomes moot point.
I have a custom build of AOSP (based on kitkat 4.4). I am controlling an arduino board via Android's USB Host API. I also am running a kernel that supports the CDC-ACM module.
I want to be able to flash new hex files onto the board. I have seen ArduinoDroid do this in his app. I have been able to flash using avrdude and the /dev/ttyACM* file that is created using the CDC-ACM driver.
However, when I grant permission for my app to communicate with the arduino board, the /dev/ttyACM* file disappears. Which makes sense because I am now controlling it via Android's USB host api. I am looking for either a way to restore the /dev/ttyACM* file or allow avrdude to use the /dev/bus/usb/#/# file in order to flash a new hex file onto the board. It doesn't appear that there is a revokePermission method in the USBManager.
The /dev/ttyACM* device file does not appear even after closing the device. I am running the following code to close the device.
connection.releaseInterface(device.getInterface(1));
connection.close();
I guess my real question is that there a way to get the kernel driver back after releasing the USB connection.
Because I am using a custom build of AOSP, I do not have google play and I cannot install ArduinoDroid on the tablet. However, I can run my app as a system level app if needed.
Ultimately I solved this, but it does seem like a bit of a hack.
Before taking control of the device (on a reboot of the tablet), I checked to see if any /dev/ttyACM* files existed. If they did, I then checked the /sys/ file system to check to see they were the correct device. I essentially checked the vendor of the usb device and matched it against the known device. Once that was confirmed, I knew it was safe to try and upload a new hex file to the device.
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" />
I have several android devices I would like to test on. Currently, when I want to test my latest build, I have to connect each device individually. It would save a lot of time if, instead, I could press "Run" and each of my devices would automatically and wirelessly update with the latest build of my app. Is this possible?
To be clear, I am not interested in remote testing as in this question. I want to test on multiple devices that I already own.
You have a couple of options.
If you have rooted devices you can use something like this to connect your adb over wifi, instead of plugging them in.
What I have started to do for non-rooted devices is copying the apk file out of the project bin folder into my dropbox, then copy the link to it and turn it into a QR code, and scan it with each of the devices.
Edit: I use a firefox bookmark to make generating the QR codes a bit easier.
This is the whole link that goes in the location box:
http://chart.apis.google.com/chart?cht=qr&chs=350x350&chl=%s
Once you have that bookmark saved in firefox all you need to do is type "qr " in your address bar and then paste the link(or anything else) you want turned into code. This along with Dropbox's custom context menu that shows up when you right click something in the public folder has an option 'Copy public link' These work together to make the process fairly painless.
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.