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..
Related
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).
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.
I need to prevent a phone from having its firmware/ ROM updated. I already disabled lots of stuff like USB debugging, but people can still go to the recovery mode by pressing Vol+ and rebooting the device and then flash a new firmware from the SD card.
Can I somehow disable the SD card slot completely without physical changes to the device or writing my own firmware?
Can I somehow disable the SD card slot completely without physical changes to the device or writing my own firmware?
Fortunately, no.
If android device has two SD CARDS then how the application detects both SD CARDS in android.For example the device has "left user sdcard" & "right user sdcard". Then How android supports programmatically
Thanks , Shiv
There will be just two mount points for two cards in file system. It depends on firmware. The device manufacturer is most likely to define. Though, I have never ever come across any such Android device (actually, no hand held device so far)
Probable mapping:
Your internal flash memory should be: /mnt/sdcard/
External cards: /mnt/sdcard/sdcard1 and /mnt/sdcard/sdcard2 (or /mnt/sdcard/sdc1 and /mnt/sdcard/sdc2)
I want to let the user safely remove the SD card in my program, but it seems the Android 2.2 public API does not provide a way to do this. Does anyone know what's a proper way to do it?
You need to take the user to the device's built-in Settings. I think this will work.
Intent i = new Intent(android.provider.Settings.ACTION_MEMORY_CARD_SETTINGS);
startActivity(i);
Unmounting the SD card is one of those actions which could be used maliciously if it wasn't under full user control. If it could be done purely in software (without user intervention) then code could disrupt other apps running on the device.
Indeed on the Logitech Revue (the Google TV companion box) that Intent call launches the Storage control panel which gives user access to the Unmount command for safe removal. If you just pull the USB device out on that unit it is experienced as an Unsafe/unexpected removal and your card could be left in proverbial disarray if treated that way. Thanks for the hint, very useful.
The Revue by the way have an unusual arrangement with the /sdcard unit built in,
so if you plug in an external SD card via USB adapter or use some USB stick it will show up under /mnt/ as a name beginning with "usb" and some number. So you have three storage areas on that unit, internal, the built in "sdcard" and USB ports where drives will mount when inserted.
I haven't earned enough points yet to be allowed to include a snapshot of how the panel looks.