We have moved to a new Sailfish OS Forum. Please start new discussions there.
29

add optional access to external SD card from android app [answered]

asked 2013-12-25 23:10:20 +0200

ortylp gravatar image

updated 2014-03-26 01:31:43 +0200

jgr gravatar image

Android Apps cannot access external SD card at the moment. It would be useful if the access could be provided without tinkering with mount command as root.

Use case: I have 30GB of data I need to make available to an Android App, It will not fit on the internal 16GBs and symlinks do not work.

edit retag flag offensive reopen delete

The question has been closed for the following reason "the question is answered, an answer was accepted" by pnuu
close date 2013-12-26 18:04:45.896717

1 Answer

Sort by » oldest newest most voted
5

answered 2013-12-26 03:44:58 +0200

palnap gravatar image

updated 2013-12-27 09:28:11 +0200

ortylp gravatar image

Just "chmod 755 /run/user/100000" from root (devel-su), then you can see the SD Card inside Alien Dalvik environment.

For convenience, you can put a symlink of the "/run/user/100000/media/sdcard" folder in the /data/sdcard Android root afterwards.

After reboot the permissions get resetted to previous state.

edit flag offensive delete publish link more

Comments

Great, it works.

Now we need some solution without the need for devel-su.

ortylp ( 2013-12-26 11:06:47 +0200 )edit
2

Yeah, maybe in a future software update...

Unfortunately, it seems each reboot erase these folder permissions... :/ I'm looking for a more permanent fix

palnap ( 2013-12-27 00:33:07 +0200 )edit
1

I just added in /usr/sbin/mount-sd.sh the following line :

chmod 755 /run/user/100000

after

            mount $SDCARD $MNT

It works fine but it's quite ugly...

palnap ( 2013-12-27 02:29:18 +0200 )edit

I did it without editing system script:

  1. Create this script and put it somewhere in the /usr/share/sdcard-symlink

#!/bin/bash

status=$(df -h /run/user/100000/media/*|tail -1|awk '{print $1}') if [[ "$status" == "tmpfs" ]]; then : else octal=$(stat -c "%a %n" /run/user/100000|awk '{print $1}') if [[ "$octal" == "755" ]]; then : else chmod 755 /run/user/100000 if [ -h /data/sdcard/SDcard_symlink ]; then : else ln -s /run/user/100000/media/sdcard /data/sdcard/SDcard_symlink fi fi fi

  1. chmod 4755 /usr/share/sdcard-symlink/symlink.sh

  2. Create service file, call it for example: symlinkboot.service and put it to /lib/systemd/system

[Unit] Description=Symlink boot After=mount-sd-onboot.service

[Service] Type=simple Environment="DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/100000/dbus/user_bus_socket" ExecStart=/usr/share/sdcard-symlink/symlink.sh

[Install] WantedBy=multi-user.target

  1. systemctl enable symlinkboot.service

  2. Now you can reboot and it will do the job ;) Or you can just install Nemo-symlink from: https://openrepos.net/content/schturman/nemo-symlink#comment-2176

Schturman ( 2014-03-05 17:02:39 +0200 )edit

I don't see /usr/share/sdcard-symlink, just /usr/share/ with a lot of directories. Should I create a script? How does it need to be named? Or should a script be edited, and if so, which script?

RobNas ( 2014-04-26 14:22:48 +0200 )edit

Question tools

Follow
12 followers

Stats

Asked: 2013-12-25 23:10:20 +0200

Seen: 2,717 times

Last updated: Dec 27 '13