6

I have a rooted Sony Tablet S, and one of my issues with it is that there is little onboard storage. The Sony-recommended way of dealing with this is to transfer files between internal and external storage, as many apps do not have access to the external storage.

Having rooted the device, however, I am able to use mount -o bind /mnt/sdcard2 /mnt/sdcard/2 to mount this. I was then intending to rename the media folder on my external sdcard to .media, and use mount -o bind /mnt/sdcard2/.media/$F /mnt/sdcard/media/$F/external for each folder $F in that directory. The problem with this is that on removal of the external sdcard, or on reboot, these mounts are lost.

On my Maemo phone I did something similar, and was able to have this mount behaviour occur when the external storage was attached. As Maemo5 is a truly open OS I was able to do this fairly easily, and there was a lot of community support.

When trying to do the same under Android I have come across an app called Tasker that performs actions as I would need, however this is paid software and I would prefer not to have to install something that performs actions which should be build into the operating system.

TLDR;

I'd like to know what is actually happening on my device when an SDcard is inserted - are scripts run? Are signals sent which could be used to trigger scripts? Has anyone attempted to do similar (I don't understand why this would not be the default behaviour to be honest - the fact that external storage is hidden from apps is frustrating to say the least)

3
  • 1
    Android in general handles SD cards more nicely than this, I think it's just your device. That said, there are events broadcast when the SD card is inserted; that's what Tasker would use. You could certainly write your own app to do the same. Commented Mar 7, 2012 at 18:37
  • @Matthew if you could point me towards some of the resources that would be useful for this, I would consider that enough for an answer. I have experience writing software but am new to Android, I have not found it easy to find resources on what this would require. Commented Mar 8, 2012 at 14:47
  • Dev questions are off-topic here unfortunately, and I haven't done any Android development myself. However, this might help: developer.android.com/reference/android/content/Intent.html Commented Mar 8, 2012 at 16:49

1 Answer 1

1

If your intention is to have your script run each time the card is inserted, or the device is booted, I'd recommend the already mentioned app Tasker, maybe in connection with Scripter. The latter can be used to execute (and manage?) scripts, but AFAIR you can do that part with tasker as well.

You would need to create 1 task (execute your script), and 2 profiles using this task (as there is no possibility for a logical OR with the conditions). One is for the boot_completed event, the other is for the inserted SD-card. That should do it.

In case of trouble (or hard understanding), just comment and I see what I can do :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .