3 Replies - 1544 Views - Last Post: 05 March 2013 - 02:59 AM

#1 XSYLUS  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 02-December 08

Storing files on removable sdcard vs internal storage

Posted 28 February 2013 - 04:32 AM

Storing files on removable sdcard vs internal storage

I have two android apps that both access the /mnt/sdcard directory the issue is that with the advancements in smartphones /mnt/sdcard more often now references internal non-removable storage as apposed to the micro sdcard that can be swapped out by the user. The dilemma is allowing the user to select whether to use the internal or removable storage. Even worse while Android uses the "mnt/sdcard" as a universal standard the removable sdcard directory tends to vary with each brand of Android devices.

I have discovered that on pretty much every Android device I can enter the command "DF" in a terminal emulator and it will print out a list which includes the exact location of the removable sdcard specific to that device. My theory is that if I can somehow get my apps to filter and read just the part of the print out from the DF command then I can add a simple radio button group to allow the user to say use internal storage or use external storage.

While I'm vaguely familiar with the dataoutputstream method and can use it to send commands, I'm a bit more hazy on what methods would allow me to read the output created by the command and then filter out all the unnecessary parts; just storing the directory path to the removable sdcard in a variable.

Any guidance would be greatly appreciated.

Cheers.

Is This A Good Question/Topic? 0
  • +

Replies To: Storing files on removable sdcard vs internal storage

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4313
  • View blog
  • Posts: 12,090
  • Joined: 18-April 07

Re: Storing files on removable sdcard vs internal storage

Posted 02 March 2013 - 12:10 PM

Well according to the Android development guides if a device uses a partition of internal storage as its "external storage" and then has something like an SD card slot then you app won't be able to store to the card.

http://developer.and...l#filesExternal

If you haven't seen this section yet it may help you understand external storage as well and point you in the right direction to answer your questions.

:)
Was This Post Helpful? 0
  • +
  • -

#3 XSYLUS  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 02-December 08

Re: Storing files on removable sdcard vs internal storage

Posted 05 March 2013 - 02:30 AM

View PostMartyr2, on 02 March 2013 - 12:10 PM, said:

Well according to the Android development guides if a device uses a partition of internal storage as its "external storage" and then has something like an SD card slot then you app won't be able to store to the card.

http://developer.and...l#filesExternal

If you haven't seen this section yet it may help you understand external storage as well and point you in the right direction to answer your questions.

:)/>


Thanks but I'm not sure which section of that document you're referring to. Also the reference to internal and external storage predates devices that have embedded sd-cards. The external storage class links to /mnt/sdcard. I just need to find a way to read and filter the output of the df command unless there's a better way to let the user choose to save the files on the removable sdcard.
Was This Post Helpful? 0
  • +
  • -

#4 XSYLUS  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 02-December 08

Re: Storing files on removable sdcard vs internal storage

Posted 05 March 2013 - 02:59 AM

Here's what the df output typically looks like:
/ $ df

Filesystem           1K-blocks      Used Available Use% Mounted on

tmpfs                   369128        32    369096   0% /dev
tmpfs                   369128         0    369128   0% /mnt/asec
tmpfs                   369128         0    369128   0% /mnt/obb
/dev/block/mmcblk0p1    516040    476832     39208  92% /system
/dev/block/mmcblk0p7  13813852   2948206  10865646  21% /data
/dev/block/mmcblk0p2    533616      8574    525042   2% /cache
tmpfs                   369128         0    369128   0% /Removable
/dev/fuse             13813852   2948206  10865646  21% /mnt/sdcard
/dev/block/vold/179:9 30306304  12222624  18083680  40% /Removable/MicroSD



As you can see the last two lines reference the internal sdcard and the removable sdcard. All I need to do is grab the very last part of that line where it has the directory path. The output above came from my ASUS Transformer which mounts the removable sdcard in the root directory rather than the /mnt directory. My Droid 4 mounts it under /mnt/sdcard-ext. Other devices use other variations.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1