3

I have rooted a B&N Nook Glowlight running Android 2.1. The device does not come with an SD card, so I symlinked to another directory from /sdcard/. Now I need to set the Environment.getExternalStorageState() value so that apps will be able to find the "card". How does one set this value?

Note that other devices, such as the Nexus S, also do not have an SD Card, yet they do return a Environment.getExternalStorageState() value for applications that require it.

Note that I am not writing an Android application which uses this value. I need to set this value device-wide so that other applications (such as Anki and Opera will be able to find it.

1
+50

The source for eclair's Environment.getExternalStorageState() is here. It looks like getExternalStorageState() comes to this:

return SystemProperties.get("EXTERNAL_STORAGE_STATE", MEDIA_REMOVED)

I think you want to take a look at the /system/build.prop file and check for a line like:

EXTERNAL_STORAGE_STATE=removed

If it's there, try changing it to:

EXTERNAL_STORAGE_STATE=mounted

To do this, adb pull /system/build.prop, modify the file on your computer, then adb remount to make /system writable (or adb shell, su, mount -o rw,remount /system)... then exit back to your computer and adb push build.prop /system/build.prop to push the modified file to /system). Then reboot.

You can try temporarily (from root shell):

setprop EXTERNAL_STORAGE_STATE mounted

...if that works, you might then programmatically try:

SystemProperties.set("EXTERNAL_STORAGE_STATE", Environment.MEDIA_MOUNTED);

Hope this works out for ya.

| improve this answer | |
  • Thank you! I am able to temporarily set the external storage as mounted via setprop EXTERNAL_STORAGE_STATE mounted. I'm trying to get the ADB working to set it permanently. Thank you! – dotancohen Oct 27 '14 at 19:54
  • Glad it worked :) – fattire Oct 28 '14 at 22:30
  • Yes, thank you! I still haven't resolved the entire issue, as this is a rooted B&N nook running Android 2.1, but you've put me on the right track. – dotancohen Oct 29 '14 at 5:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.