Enable the SD Card while USB Debugging? - android

I am developing a phone app and I'm testing it with my Droid RAZR with OS version 4.1.2
I need the phone to be able to use its SD card, and prevent the computer from using the USB connection as a "mass storage" connection, which causes it to take over the SD card (it can only be mounted to either my phone or the computer, not both).
You used to be able to connect to the computer in "Charge Only" mode, which would keep the SD card active with the phone, but that no longer seems to be an option. There is only Mass Storage (computer uses SD card), Media Device (same story), and Camera (same there too).
Is there another option? Perhaps some way to disable the mass storage from the PC's side but still retain the USB Debugging?

Take a look at this thread here. As stated there:
Next, enable USB debugging by checking the “USB Debugging” item.
Finally – and this is the most oddball – you need to go back a screen,
to Settings, and click on the Storage item. Up in the upper right of
the screen are three tiny squares which represent the Jelly Bean way
of doing a context menu. Click that, and a small “USB Computer
Connection” item will appear. Click that. You’re taken to a new
screen with two “Connect As” options.
Check “Camera”. Yes, because USB debugging requires the use of a
camera (no, not really). It’s just a requirement. Something about
the communication protocol or file transfer encoding or something. I
don’t make this stuff up.

Related

Activate OTG on non-otg Android phone

I have an old LG K120 that by default doesn't have OTG. So I did what was needed (root the phone and installed a software that now tells me OTG is active) however when I try to plug a usb pen or card reader, it doesn't detect it. I hope I don't have to install a custom rom or whatever it's called risking to ruin everything. I just need to read a microSD without having to open the cover all the time.
For running SD cards on the mobile you can use some of the pocket Wi-Fis which support SD card inside them,like some of the JioFis (check before you purchase any,if you). Then connect it to your mobile using Wi-Fi(Password protected or open) and run it.
And for running pendrives(only) you can use the SanDisk Wireless Stick pendrives, which run on Wi-Fi.
Edit: USB can also be used for radiation free transfer with laptop computers.(Credit goes to blackapps).

Android USB defaults to "power only"

Here's a quick tip if you need to connect an Android phone (or tablet) to a PC using USB to transfer files but find that Windows "sees" the Android device but can't see the storage on the device.
The Android device may have simply decided it will just draw power from the USB connection and not allow file transfer. There is no obvious fix for this in Android setup but here's one way to diagnose the problem and then fix it.
First plug your USB cable from phone (or tablet) to PC. On your Android, tap on Settings (the sprocket icon) and find the "Wireless & networks" heading at the top, select More (with three dots to the left), then select "Tethering and portable hotspot" followed by "USB tethering". Select it and you should see the three-branch USB symbol in the status line at the top of your screen. Swipe down from the top and you should see "Tethering or hotspot active" with "Touch to set up" below it.
Just below that you may see "USB for charging" with "Touch for more options" below it. If you see this you have diagnosed the problem. Your phone is telling your PC "all I need is power" and, by implication, "don't look at my storage".
To fix the problem, tap that USB message and you should see three or four radio buttons - "Charging" (with button selected) and "File transfers" below plus one or two more options below that. Select File transfers and your PC should now see the storage on your phone - internal and (if you have it) any SD card you have installed. Transfer your files using whichever style your prefer (click and drag, copy and paste, etc)
This works for Windows 10 and Android 6.0.1 on a Wileyfox Swift (cyanogen version of Android) and Android 6.0 on a Motorola Moto G (3rd generation)
There may be a more "kosher" way round this problem but I can't find one and the Wileyfox helpline was responsive but unable to help in the end
Does anyone have a more "kosher" fix for this problem/ Especilly one that will "stick" so I don't have to do this every time I want to trnsfer stuff to/from PC to Android
In my opinion you can have two problem: the first is that your phone doesn't have a SD-CARD as external memory storage. The second is that your OS doesn't have specifical driver for these devices. Can you run ADB shell on your computer?
if you go into developers options go down to networking then select usb configuration and chose PTP picture transfer protocol or whichever you want this will hopefully sort the missing folder/empty issue

How to set Android M default USB config to MTP rather than "charging only"?

Whenever my device (Nexus 5, Android M Preview 3) connects via USB, the USB config always defaults to "charging only".
This is quite problematic because the USB port on my device is faulty and sometimes disconnects and reconnects when bumped and so I have to manually change the mode to MTP (media transfer protocol) from the notification drawer each time.
Debugging mode is enabled
Develop settings -> USB Configuration is set to MTP.
I just tried this on my Nexus 5 (Android 6.0.1) and it worked:
Make sure your phone is NOT connected to any device over USB cable
Go to Settings - Developer options - Select USB Configuration
Set your desired default connection type
The trick was to have a phone disconnected from USB. I guess the idea behind such a behavior was that if you set an USB connection type while your phone is not connected to any device, it will be treated as a default behavior.
By Default, Android 6.0 does not provide an automated method to select MTP when the device is connected as USB. After much wait and research through XDA, blogs, stackoverflow etc, the best solution I found to this was a small application, named MTP enabler PRO Marshmallow(4.5 MB) - built by one of the users to overcome this problem.
This requires a rooted device.
Below is a link to download the APK file.
http://forum.xda-developers.com/android/apps-games/app-mtp-enbaler-t3263467
Below is a link to the app in PlayStore(paid app)
https://play.google.com/store/apps/details?id=mtp_enabler.esolutions4you.de.mtpenabler&hl=en
Hope it helped.
This is a major problem for a layman to use. To access the files on your PC you need to follow the steps mentioned below:
Swipe down on the screen, tap on "USB for file transfer".
Select the option "Transfer Files(MTP)".
Primarily this should solve the problem.
But, if this DOES NOT solve the problem, then follow the following steps.
Make sure the SD card is inserted properly.
Go to "Settings-->Apps".
Tap on the three dots on the TOP RIGHT corner of the screen and tap on "Show system apps".
In that list of apps, find the apps "External Storage" and "Media Storage".
Now clear the data and cache for those apps.
Reboot your device.
Now go to "Settings-->Developer options" and enable "USB debugging".
Then tap on "Select USB configuration" and select the option "MTP(Media Transfer Protocol)".
Now connect your device to your PC and you should be ready to go.
You have to follow these steps only once, however, you need to select the type of connection every time by swiping down on screen and selecting the option "MTP".
Hope this helps...!

Terminology for SD Card Status

We've developed an Android program that relies on access to a particular directory on the SD card. Our program detects whether the SD card is available to the phone, and displays an error message to the user if it's not. The most common use case that will trigger this error is having the device plugged into a computer and having the SD card mounted to the computer.
We're working on the error message, which will instruct the user to make sure the SD card is available to the phone.
Unfortunately, it appears that each phone manufacturer has their own terminology for whether the SD card is available to the phone and how to mount/unmount it. For example, (some?) Samsung devices display a screen with a Mount/Unmount button. The HTC Thunderbolt has a menu one of whose options is "Charge Only". Motorola devices seem split between the Samsung-like behavior and the HTC Thunderbolt-like behavior. The XOOM is it's whole own contraption.
So, two questions:
Is there a common correct terminology that will communicate to the user that they should make the SD card available to the device instead of available to the computer?
If there's not a good common terminology, is there a way to determine what sort of device we're running on and tailor our error message to the particular device's terminology?
"Please remove all usb peripherals (exc chargers) for this app to work"?
NB. (when its mounted but they think its just a charger they will eventually remove it to see if it works anyway!)
Otherwise:
http://developer.android.com/reference/android/os/Build.html
Check out BRAND or MANUFACTURER or a combination of them plus others (MODEL == 'XOOM' maybe?)
if("Motorola".equals(android.os.Build.MANUFACTURER)){ // or .contains or .starts with etc
// Do stuff
}
You may want to do some testing as it may return "Mtrla" or "MotorolaChina" etc..

How to set the Usb connection mode?

I'm writing an application which is supposed to dump data on the SD card and then another application on a pc which should read the data when the device is connected to the pc (in disc drive mode).
On my HTC Legend there is a dialog to choose between: Charge only, HTC Sync, Disk drive..
Is there a possibility to set the mode with which the device is connecting to the pc
or at least an intent to ask the user to switch the mode?
I haven't found a way of setting the mode programmatically, but I believe you can bring up the settings menu programmatically by invoking the same activity that the system invokes from the notification area. Unfortunately this appears to be manufacturer-specific: on my phone it is com.htc.android.psclient.SwitchUsbSettings.
On HTC devices, open the ConnectToPC service (whilst USB is not plugged in) in Manage Apps (ICS - probably applies to Gingerbread too; don't remember), and hit Clear Data. Then, plug the USB back again, and you should have the option to "Don't ask again" available. Select your desired mode, check the box, and accept.
CompanionLink does this when you request a USB sync in their android app: it flushes data to SD, then exports the SD as storage (a "disk drive") on the USB, then waits for the user to manually signal the android app when the PC is finished using the SD, and then undoes the SD export to USB again. Though the CompanionLink app can be very frustrating to use, at least this part of it is (largely) reliable.
Unfortunately I don't know the technical details, may well need to figure them out myself one of these months. If you can't get any traction with android docs, perhaps you could study what CompanionLink does on android to implement this. The sequence I describe above is when it is configured to sync over USB against a (PC-based) Palm Desktop.
As an aside, it appears that the reason for this highly-convoluted process is that the SD card's FS is accessed directly and at least the presently-used card FAT FS can only support a single client: the phone itself or USB. imo it would be extremely helpful if concurrent shared access to the SD were possible, but this would likely require deep android changes.
For anyone having this issue with an HTC One M8, this is a bit off the wall, but makes the point to think outside the box. A USB connection resulted in the device charging, that was it.
The solution was the combination of a different USB cable, uninstalling an application called Battery Doctor (which apparently likes to manage everything around your battery), AND USB Network Setting - turn ON Smart Network Sharing...Seemingly unrelated...but this combination got my connected with MobileGo for Android to manage and back up files,contacts and settings.
Hope this helps someone.
Yes .In Android there is a way to change the behaviour of the devices`s USB mode when the device is connected with the PC.
I used a Motorola Milestone[running 2.1] and i was able to switch between the following modes :
PC Suite[developed by Motorola],MemoryCardAccess and Charge alone.
If you need to access phone memory I think you should turn ON "USB Debugging Mode " in your device.Am not sure about it though,I feel it may be handy !!

Categories

Resources