[Q] How do you programatically get the path of external SD Card? - Atrix 4G Q&A, Help & Troubleshooting

I have a Market app and an Atrix user has reported a problem. My app uses Environment.getExternalStorageDirectory() to get the phone's user storage location to keep the user's files. However, with the Atrix there seems to be both internal AND external storage, and Environment.getExternalStorageDirectory() only returns the handle to the INTERNAL storage.
How can I get the location of the EXTERNAL storage area for the Atrix? (Hopefully this will not require a hard-coded check of Build.MODEL. But, if it does, what is the Build.MODEL value for the Atrix?)
Thanks for your help,
Blake

I'm no dev / programmer, but try:
/mnt/sdcard-ext/<user folder>
This is the storage path I give Titanium backup to accesses the external sdcard storage. Hope this helps.
Sent from my MB860 using XDA Premium App

Moved as not android development

Actually this is a question directly related to android app development...
You may want to take a look at the Motorola Atrix SDK add-ons that are posted in the Dev forum. There might be additional functions/activities available that you can call when your app is on an Atrix.

I normally agree with mods, but I have to agree with agentdr8 here: I think this is a fair question to ask in Android Development.
In any case, if you wanted a broader method, I'd suggest querying /proc/mounts and filtering out invalid results. Chances are that everything that's mounted as vfat would be fair game, barring stuff like /mnt/secure.

you can get external sdcard directory
MotoEnvironment.getExternalAltStorageDirectory()

Related

[Q] Can android support JBOD (just a bunch of disks) array

Just want a yes or no from an android boffin.
Cheers
Linux does so Android could.
That would be interesting to make the internal and external storage appear as one.
I agree with this idea, but, what popup in my mind is, what happen if one of the disk failed? most high risk is, sdcard damage.
All data or some can be retrieve?

[Q] Hidden folders through Android MTP

Hey !
I've searched the web as well as the forum but i didn't find any solution and it seems i'm not the only one wanting to do that.
Is it possible to see hidden folders of internal sdcard through MTP ?
I really talk about hidden folder like ".android_secure", not the photos that aren't yet scanned by the media scanner service.
In my windows environment i already set the view all hidden files/folders as well as view system files.
If i have to change folders permissions through terminal what are the correct permissions i should put ?
Thanks for the help !!
Am i the only having that problem ?
Do you guys see the hidden folders through mtp connexion ?
If you'd bother reading a bit before asking questions, you might have the answer already.
http://en.wikipedia.org/wiki/Media_Transfer_Protocol
MTP and PTP specifically overcome this issue by making the unit of managed storage a local file rather than an entire (possibly very large) unit of mass storage at the block level. In this way, MTP works like a transactional file system - either the entire file is written/read or nothing.
More or less, it is designed to keep hidden what should be hidden stick to USB storage or FTP/SCP.
PS: can't believe we're using a transfer protocol designed by Microsoft in a Linux-based system mastered by Google. The horror, the pain... no wonder it doesn't work on my Mac!
VAXXi said:
If you'd bother reading a bit before asking questions, you might have the answer already.
http://en.wikipedia.org/wiki/Media_Transfer_Protocol
MTP and PTP specifically overcome this issue by making the unit of managed storage a local file rather than an entire (possibly very large) unit of mass storage at the block level. In this way, MTP works like a transactional file system - either the entire file is written/read or nothing.
More or less, it is designed to keep hidden what should be hidden stick to USB storage or FTP/SCP.
PS: can't believe we're using a transfer protocol designed by Microsoft in a Linux-based system mastered by Google. The horror, the pain... no wonder it doesn't work on my Mac!
Click to expand...
Click to collapse
Thx for the link ! I knew what mtp is but its always good to refresh things up
I read the whole article and unfortunately it doesn't answer my question.
I understood that its the same for all of us meaning that we are not able to see hidden folders.
But the main question is if there is a way to bypass this behavior ? Where is this defined exactly ?
It seems according to the article that its not on the file permission layer ? Should it be at partition level ? How can mtp know what to share with the host ?
It's not a "behaviour" per se, but more/less a database. Remember that media scanner program which wakes up every time you change something on your SD card, be it internal or external ? it simply keeps a "database" of files which are presented to the MTP client (your computer) and hides away the phone's internal folders which are not supposed to be seen by the end-user.
Theoretically, this is done in order to have the iPhone-like behaviour: seeing the entire device memory as one big unified storage which you can fill as you want (no more of those partition size limitations which brought us the app2sd hacks). In my opinion, it's more or less just a small step done in order to "secure" phones for DRM protected content.
Studios and media companies require devices to have such measures of protection in order to allow you to sell media content (like movies, books, etc) and since Google wants to push its business further with the Play Store, it needs to cave in to the studios' demands. In the future, it will probably even become illegal (DMCA-style) for me to give you the information below
Back to the technical part of our show now.
At the first boot in the life of the device, Media Scanner will look under /system/media and index everything there. After that, it will scan everything under /mnt/sdcard (hence your external SD card too, if you have one, as it's mounted under /mnt/sdcard/external_sd). On some devices, you have an "internal.db" file and one "external-123xyz.db" file; that's a unique ID of the SD card which was scanned. The idea here is you might have 2-3 SD cards which you swap often, and it's not nice to do a full rescan each time you change the SD card. These databases are in /dbdata/databases/com.android.providers.media (on my phone, there is only one "external.db" for example).
So what you're looking for is a way to populate this database with all the files found by the Media Scanner. But Media Scanner doesn't want you to see the hidden folders you mentioned above. So, you get an application which doesn't ignore them, like Rescan SD Card! or SDrescan.
Happy now ?
Thank you very much i really enjoyed reading the explanation as it answers completely my questions and it makes sense !
Ill give a try to the apps but i'm also curious to investigate on those files
Cheers
PS. Is this a disguised way to support non open source protocols ?
Well, you could poke around inside the database with sqlite if you want. But don't really see what's so interesting about them.
It is just another protocol which is supported, which happens to be designed by Microsoft (and probably licensed/paid by Google to be used in Android). I understand the technical explanation behind this decision, but I'm also wary that someday UMS will be disabled by default and enabling it will disable content purchasing for that device (just like having a rooted phone now disables some "sensitive" apps, like banking and online TV).
As a system admin its interesting to know whats happening on my system
As a hobby its interesting for my personal knowledge
And from a development point of view it gives me some ideas for maybe future apps
You say that its just another protocol which is supported but to my understanding there are not so many of them ! So i would say that Google was kind of forced to use the MTP method, first from a hardware point of view and second to be compliant with the rest of the world.
Is there any other protocol that could suite their needs ? Since USB mass storage is not usable on some devices and MTP is well spead.
.HiddenAndroid folders in Win - Here Yesterday, Gone Tomorrow
<Win 7 and GN2>
What's curious and a bit frustrating to me is that, yesterday, when I mounted my device ALL of the hidden (.folders and .files) were visible and searchable. Today, when I went to explore some more, all are gone. I understand that I can use a 3rd party app, just can't figure out why it was visible yesterday and not today.
Hmmph
Did you ever resolve this issue? I really hate MTP for several reasons but this is one of the reasons why! I need to back up all my directories on the SDCard because some apps store them as hidden files in hidden directories. Furthermore, I came across the Play Store bug that requires me to delete a "temp.asec" file in the ".android_secure" directory, but of course it is not visible.
In a post further up it was suggested to use a "Rescan" app to force the DB to include hidden files/directories, but I have tried no less than 4 of these apps, and all they do is trigger the built-in android media scan, which is the problem in the first place!
So has anyone ever been able to access hidden files and directories using MTP?
EDIT: I have an HTC phone that actually shows hidden files and directories, so they have obviously implemented their own media scan. The problem I am currently having is on a Samsung phone (Epic 4G touch)
It may depend on the implementation. For example, using stock rom for the phone doesn't show some files and folders, for example folders starting with dot. But if you use Neatrom Lite it will show all files and folders.
Flash forward about 6 years and Samsung still does not show hidden folders/files when viewing the phone contents in Windows File Explorer, but HTC does.
The reason this is still a problem for me, is that I want to backup the contents of a particular directory (WhatsApp) which contains some hidden folders, so I can restore it anytime on a new phone or the same phone.
I recently switched from HTC to Samsung and alas, it seems the problem with this implementation still exists. Anyone found a workaround to this to allow File Explorer to see the hidden folders?
Update: It appears that hidden .nomedia files (and probably others) appear under regular folders, so the problem is limited to hidden folders themselves

Droid Incredible 4G LTE FAQs

I've noticed a lot of similar questions around these forums, so I decided to collect some in the same place. This is by no means an exhaustive list.
I can haz root/S-OFF?
There are options for unlocking your bootloader by changing your SuperCID, also there are options for obtaining S-OFF.
Thanks to Team Fireballas for the root method, and thanks to unlimited.io for S-OFF.
Now, please, don't talk like that anymore. Proper grammar, spelling, and punctuation help us understand the question or point you're trying to get across.
My FriendStream (or another HTC) app is missing
HTC decided to remove the FriendStream widget from view in an attempt to de-bloat Sense. On the stock ROM, you can still access it via the lockscreen and somewhat through the Social Clock.
Lockscreen: Settings -> Personalize -> Lock Screen Style -> Friend Stream
Social Clock: Widgets -> Clock -> Social Clock
On the stock ROM, there are several HTC apps missing from our phone, including the beloved flashlight. However, not all the apps are truly missing, just hidden. If you have root, you can re-enable it in the default.xml file located in the /system/customize/MNS/ folder. Remove the listing for FriendStream or whatever app you want to view in the app drawer from the "application_hide" function. FriendStream might also require the listing under "shortcut_hide" to be removed, as well. If you are rooted, a custom ROM may not have this problem.
Why do I have this annoying Wi-Fi icon?
For whatever reason, HTC or Verizon decided to add an annoying Wi-Fi nag icon in the notification bar telling you that you should turn on Wi-Fi. Why Verizon wouldn't want you to go over your data limit and owe them more money is beyond me. If you have root, there is a pretty simple fix for this, or try a custom ROM.
Can I use 64GB MicroSD cards?:
Our phone lists 32GB as the largest capacity microSD card it is capable of utilizing. However, that is the largest capacity allowed by the SD 2.0 standard, SDHC. SD 3.0 currently allows 64GB SDXC cards to be backwards compatible with SD 2.0 ports. Since every single 64GB card isn't necessarily going to work, it's best to read around and find the specific models which do.
Why do the official specs say our phone has 8GB of internal storage but I have less?:
Due to the controversial naming scheme of hard drives and other forms of data storage, companies actually give you less storage than you anticipated. 'Giga' is an SI decimal prefix meaning 10^9, or 1 billion bytes. Before hard drive capacities were in the gigabytes, hard drives used the IEC binary capacity for megabytes (2^20), albeit with the SI prefix. RAM is still calculated with the IEC value but with the SI prefix. So, when your internal storage is calculated to be 8GB, it's actually 8 x 10^9 rather than 8 x 2^30. Since Microsoft has been around since the other standard was set, Windows still displays storage capacity in the binary fashion and labels it with the decimal format.
On top of that, the Android system takes up a sizable amount of storage space, which is included in our phone's internal storage capacity, so you're only allowed 4.15GiB of data storage, which is 4.457GB. In short, you've got 8 billion bytes, but only 4.457 billion bytes usable, which is 4.15GiB. A similar capacity change will be noticed on your MicroSD card size. For example, I have a 32GB MicroSD card, which is actually 29.7GiB. I have a 2TB hard drive, but I only have 1.818TiB available. That's almost 200GiB "missing" because of the naming scheme.
What's the deal with the SD card naming scheme?:
Android 4.0 introduced a new way that SD cards are handled by the system. Previously, the eMMC internal storage of the phone was in the '/emmc/' folder, and the SD card was '/sdcard/'. Makes perfect sense, right? Way to screw it up, Google. Now, the internal storage is in the '/sdcard/' folder, and the real SD card is '/sdcard2/'. There's nothing you can do about this without serious modding to the system. It was changed because Google considers our phones to be high capacity now, so the need for microSD has passed. Yes, portable storage isn't necessary. If you have root, there's a mod that can switch it for you.
Can I install apps to the SD Card?:
Unfortunately, if you are unrooted and on the stock ROM, as per the SD card naming scheme change mentioned immediately above, apps can no longer be installed to the SD card. Like I mentioned above, if you have root, there's a mod for that. Otherwise, when saved in the 'Internal storage', apps are saved in the normal location of apps, '/data/app/'. When saved in the 'Phone storage', apps are saved in the eMMC internal storage partition '/sdcard/.android_secure/' as a '.asec' file.
Can I use Google Wallet?:
If you are rooted, then there's an experimental method that may let you successfully run Google Wallet.
Is our phone capable of being used globally?:
The latest 2.17.605.2 update enabled global phone on our phone. Go to Settings -> Call, and change Preferred Network to Global.
These have been the most common questions I have seen, and I'll be updating this list with more pertinent information when it arises. There are plenty of other questions that have been answered, even more which haven't. Look around for questions, and if there isn't an answer, don't be afraid to ask.
FYI the debugfs root method doesn't look to be working... not sure if you saw that in the other thread or not.
Had to throw up a pic...64GB....the only way to go
Card is a Sandisk 64GB micro.
Is there a patch available for that Wifi thing? I don't have much of a problem doing it manually through the APK, but if there's a faster way...
Platypus222 said:
Is there a patch available for that Wifi thing? I don't have much of a problem doing it manually through the APK, but if there's a faster way...
Click to expand...
Click to collapse
Hey self, nevermind. If anyone else wants to just copy over the APK that you need to modify, just do what I said here -- http://forum.xda-developers.com/showpost.php?p=30679535&postcount=40. You will need root, though, and I understand a lot of people don't. All it is is removing a few images that for some reason stops the notifications as well.
Platypus222 said:
Hey self, nevermind. If anyone else wants to just copy over the APK that you need to modify, just do what I said here -- http://forum.xda-developers.com/showpost.php?p=30679535&postcount=40. You will need root, though, and I understand a lot of people don't. All it is is removing a few images that for some reason stops the notifications as well.
Click to expand...
Click to collapse
lol. I appreciate you making it readily available for us, but most of us don't have root. Here's to hoping our spamming Verizon works quickly!
I added to and updated a few things on the list. Hopefully people will read it before asking the same things over and over.
IceDragon59 said:
Hopefully people will read it before asking the same things over and over.
Click to expand...
Click to collapse
Ha ha. You funny guy...
Jafmf95 said:
Ha ha. You funny guy...
Click to expand...
Click to collapse
I know. The likelihood of that, right?
Bump
Please add the DirtyRacun s-off method.
I'm sure there's other stuff, too. Lots had happened since we received s-off.
Thanks
Sent from my Fireball using Xparent Blue Tapatalk 2
+1 sticky plz
IceDragon59, you've done a nice job with the FAQ, I wonder if you might also consider taking on the task of making an index post for ROMs, recoveries, unlock methods, scripts, themes, etc?
Oh, and it looks like you can remove the please sticky notice from the title.
mdmower said:
IceDragon59, you've done a nice job with the FAQ, I wonder if you might also consider taking on the task of making an index post for ROMs, recoveries, unlock methods, scripts, themes, etc?
Oh, and it looks like you can remove the please sticky notice from the title.
Click to expand...
Click to collapse
That's not a bad idea. I'll make it my weekend project. And thanks for pointing out the fact that this thread finally got stickied after 5 months.
FYI, the direct link in the OP to the post with the .apk for killing the wifi nag is outdated. It takes you to post #40 in that thread, but that .apk may actually botch things up for folks running the latest stock Sense. There is a post a few posts later with an updated .apk to match the more recent Sense.
Question
Is this an hpdi/mdpi device? sorry for being ignorant...
Thanks in advanced to whoever can answer this!
mr_dr_parker said:
Is this an hpdi/mdpi device? sorry for being ignorant...
Thanks in advanced to whoever can answer this!
Click to expand...
Click to collapse
hdpi
Thanks!
jose51197 said:
hdpi
Click to expand...
Click to collapse
Thanks!
My incredible dont work with samsung USB cable (I hawe 2), but works with LG G2 USB. why is that?
kobebryant said:
My incredible dont work with samsung USB cable (I hawe 2), but works with LG G2 USB. why is that?
Click to expand...
Click to collapse
Strange, my works with Samsung cable good, same like on original htc usb

Idea regarding writing to external, vs internal storage

I'm not well versed in the usage of Linux commands at all, but I am familiar with the concept of symlinking. Would linking sdcard0 to sdcard1 allow for apps to write directly to the SD card, rather than internal storage? I would love someone's thoughts on this, and a method to make this happen, or another fix to enable/force writing to the SD. I mean what's the point of supporting up to 64 GB SD cards, if you can't use the thing? Anyway, thoughts, comments, whatever you'd like is welcome.
Sent from my ASUS PadFone X mini using XDA Free mobile app

Emulated storage: Virtual or Real

Yesterday I posted a question about emulated storage which was roundly ignored so I'm trying a different approach. I'll tell you how I "understand" it & you can correct me. Most of the info I found was either beyond me or it lacked detail. My take is that emulated storage is a work-around created because of a change in how Android accesses apps & data, or how the stuff is stored, or something. (aside: the approach sounds clumsy & inefficient to be working with 3 copies of the same data-- one in sdcard0 & 2 in the emulated folder.)
I don't think I have the concept. There's discussion of multiple users, which makes sense with tablets but not phones. Why wouldn't Android code have a statement like "if tablet, X; if phone, Y", which could bypass the multiple users for phones? Maybe "multiple users" means something else?
Is the stuff in the emulated folder real or virtual? Or is it a moot question... ie, is my internal storage being eaten up regardless of whether it's real or virtual? (Should I be mad about it?)
May have more questions after y'all tell me how emulated really works

Categories

Resources