[MOD][XPOSED] Music2SD (v1.8) - Make Google Play Music save music where you want - Xposed Framework Modules

NOTE: You do not need this app if you do not have external storage or if you are on KitKat or above.
This application requires root and the Xposed Framework - http://forum.xda-developers.com/showthread.php?t=1574401
Do you not have enough room on your Internal Storage or Device Storage for your music, but have plenty of space on your SD Card? No more with Music2SD! You can now force Google Play Music to store your music where you want it.
How To Get Started:
Install Xposed Framework Installer.- http://forum.xda-developers.com/showthread.php?t=1574401
Install Xposed Framework.
Install Music2SD
Open Music2SD and Select a Download Storage Location.
Open Xposed Framework and Enable the Music2SD Module.
Restart your phone/tablet.
Start downloading music!
Currently Tested on:
Galaxy S4 (Running CyanogenMod 10.2)
Galaxy Note 2 (Running CyanogenMod 10.1)
Galaxy Note 10.1 (Running CyanogenMod 10.1)
Galaxy Note (Running CyanogenMod 10.1)
Infuse 4G (Running Beanstalk)
Nexus S 4G (Running CyanogenMod 10.2)
Motorola Droid (Running CyanogenMod 9)
Google Play Store
Source Code

Change Log:
Version 1.8
Fixed Method overwriting for newer version of Google Play Music.
Version 1.7.1
German Localization added.
Added exception handling for StatFS.
Version 1.7
Localization Update (Support for English, French, Italian, Japanese, Korean, Portuguese, Russian, and Spanish)
German Support coming soon. (Waiting on translation.)
Free disk space fixed. Now using StatFs built in API.
Version 1.6.1
Major Bug Fix
SD Card Support now sends "df" command.
Version 1.6
Storage Location Selector now shows path and free disk space.
Storage Locations that would show up as "Device" will now show up as "External"
Will now display removable mounts with read/write permissions that do no show up under the environment variables as "Unknown Storage". Use caution when using these.
Tested and works with Meenova Mini MicroSD Card Reader.
Version 1.5.2
Fixes support for "mount" commands with "on" and "type" verbiage. For real this time.
Fixed reported NullPointer Exceptions.
Added additional information "SD Card Support" to help pin point device/rom specific issues.
Version 1.5.1
Fixed support for "mount" commands with "on" and "type" verbiage.
Version 1.5
Fixed Force Close issue.
Version 1.4
Improved SD Card detection. Now doesn't look at File System, but instead looks at Environment Variables and compares them to what is mounted and has read/write access.
Music2SD Debugger built-in.
Added Admod Ads.
Version 1.3
Fixed an issue with older devices that emulates a SD Card. For example the Nexus S 4G was showing Device Storage and External Storage.
Now checks for root access and Xposed Framework on app start.
Now uses root access to automatically create the necessary directories on your SD Card.
Version 1.2
Code clean up.
Support for multiple external storage locations.
Tablets now work in Landscape.
Version 1.1
Fixed NullPointerException while searching for SD Card on non-rooted device. (You must be rooted to use this application!)
Version 1.0
Initial Release
License:
Code:
Copyright (c) 2014, Lepidus Development LLC
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Nice! Is this for the synced music you can save to your device through all access or purchased music?
Sent from a Galaxy within my palm

Caradineme2 said:
Nice! Is this for the synced music you can save to your device through all access or purchased music?
Sent from a Galaxy within my palm
Click to expand...
Click to collapse
Yes, It's for the synced music, cache, and album artwork.

StevenMattera said:
Yes, It's for the synced music, cache, and album artwork.
Click to expand...
Click to collapse
Awesome, great mod man. This is going to come in handy. About to test on M.O.A.R. rom with Sprint galaxy s3. Sure all will work fine but will report back to let you know.
Sent from a Galaxy within my palm

Caradineme2 said:
Awesome, great mod man. This is going to come in handy. About to test on M.O.A.R. rom with Sprint galaxy s3. Sure all will work fine but will report back to let you know.
Sent from a Galaxy within my palm
Click to expand...
Click to collapse
Curious if everything worked for you. Please let me know if I could be of any assistance. If everything is great please feel free to leave a review on the Google Play Store (If you downloaded from there). Thanks!

I have not been able to get it to work on a verizon s3. Music is still downloading to internal storage. Do I need to delete any folders on internal storage for it to work?

APeaceofStrange said:
I have not been able to get it to work on a verizon s3. Music is still downloading to internal storage. Do I need to delete any folders on internal storage for it to work?
Click to expand...
Click to collapse
Same thing here on Sprint S3, acted as if it worked. Started re downloading but still went to internal. Any suggestions on this?
Sent from a Galaxy within my palm

will it save from the point of the mod and you need to manually move the old folder or does the folder get moved by the app?

No folders have moved at all. Should I create the parent folders then just cut and paste the files into the created folders?
Sent from a Galaxy within my palm

Installed this on my Samsung Galaxy S4 and am not seeing the "SD Card" option as shown within your video. My internal is at /storage/emulated/0/ ( /mnt/sdcard/ ) and my external is at /storage/extSdCard/ ( /mnt/extSdCard/ ).

APeaceofStrange said:
I have not been able to get it to work on a verizon s3. Music is still downloading to internal storage. Do I need to delete any folders on internal storage for it to work?
Click to expand...
Click to collapse
Caradineme2 said:
Same thing here on Sprint S3, acted as if it worked. Started re downloading but still went to internal. Any suggestions on this?
Click to expand...
Click to collapse
Caradineme2 said:
No folders have moved at all. Should I create the parent folders then just cut and paste the files into the created folders?
Click to expand...
Click to collapse
I have found an issue with Music2SD. You must create the parent folders in your SD Card first. I will release an update to fix this most likely tonight. To get it working right now simply create the following folders in the root of your SD Card: /Android/data/com.google.android.music/
12gage said:
will it save from the point of the mod and you need to manually move the old folder or does the folder get moved by the app?
Click to expand...
Click to collapse
The folders don't get moved I will try to add this in the next update.
stew721 said:
Installed this on my Samsung Galaxy S4 and am not seeing the "SD Card" option as shown within your video. My internal is at /storage/emulated/0/ ( /mnt/sdcard/ ) and my external is at /storage/extSdCard/ ( /mnt/extSdCard/ ).
Click to expand...
Click to collapse
What file system are you using on your SD Card. Because Android does not have a built-in API for getting the location of the SD Card I'm left to parsing out the "mount" command and parsing out mount points that are using a FAT file system. On top of that the location for an SD Card is different per Manufacturer per rom. (If anyone know a better way of getting this information, please feel free to let me know.)

StevenMattera said:
I have found an issue with Music2SD. You must create the parent folders in your SD Card first. I will release an update to fix this most likely tonight. To get it working right now simply create the following folders in the root of your SD Card: /Android/data/com.google.android.music/
The folders don't get moved I will try to add this in the next update.
Click to expand...
Click to collapse
Worked like a charm, all music on external sd now. Thanks man, this is great.
Sent from a galaxy within my palm

Version 1.3 is now on the Google Play Store and on the main post. The source code has also been updated on GitHub.
Fixed an issue with older devices that emulates a SD Card. For example the Nexus S 4G was showing Device Storage and External Storage.
Now checks for root access and Xposed Framework on app start.
Now uses root access to automatically create the necessary directories on your SD Card.
Click to expand...
Click to collapse
I actually had code in there to create the subdirectories. However apparently the WRITE_EXTERNAL_STORAGE permission only gives you permission to write on the device storage and not the actual SD Card. After doing some research the only way to write to the SD card is to be a system app with WRITE_MEDIA_STORAGE permission or to do it through root. Seeing as I can't sign my app as a system app, I went with doing it through root. (This is why Music2SD asks for root when you open the app now.)
I also created a video showing how to setup Music2SD, it's on the Google Play Store listing and below:
IMPORTANT: If you have an issue where your external storage is not showing up there will be a new application in the main post called Music2SD-Debugger.apk. Please install and run this application. It's a simple app that gets the output of the "mount" command and puts it into an email. All you have to do is send the email and then I will analyze it and improve the SD Card detection. Android does not come with a built in method for detecting and getting the path of external storage devices, which is why I'm left to these weird and hacky methods of getting the SD Card path.

works like a charm but you have to delete the music stored in the old music folder and redownload (or move it all)
it is NOT moved automatically
though thanks, have been searching for something like this for months as the downloaded music unnessecarily fills up my /data partition thus making nandroid backups nearly impossible on my 16gb galaxy nexus

This module works great on my Galaxy S2, running SlimBean 8.1 (4.2.2) Only problem seems to be that all of my music is designated by number in the actual folder. Artwork appears to be all there and Google certainly recognizes what music is on the device, but using ES File Explorer to view the folder shows only numbers. Was this also true of the native folder? I never looked in it, so I don't know.

xhepera said:
This module works great on my Galaxy S2, running SlimBean 8.1 (4.2.2) Only problem seems to be that all of my music is designated by number in the actual folder. Artwork appears to be all there and Google certainly recognizes what music is on the device, but using ES File Explorer to view the folder shows only numbers. Was this also true of the native folder? I never looked in it, so I don't know.
Click to expand...
Click to collapse
That is true of the native folder as well.
Awesome module, my 64gb external loves it

Anyone have issues of it always downloading the files again
Sent from my GT-N7105 using Tapatalk 4

LancerV said:
Anyone have issues of it always downloading the files again
Sent from my GT-N7105 using Tapatalk 4
Click to expand...
Click to collapse
I think mine my have done it twice after initial setup but not since
Sent from a Galaxy within my palm

I'm having an issue where nothing happens. Granted root and enabled in Xposed.
It detects Internal Storage at /data and Device Storage at /storage/emulated/legacy. After plugging in my USB drive, it detects External Storage at /storage/usbdisk0. All is good. But no matter what I pick, it stays at the screen and nothing happens.
Nexus 4 on CM10.2.
Been simply using a symlink before stumbling upon this module (the default storage location is /data which is ext4).
Cheers
edit: Well I'll be damned. New 1.6.1 fixed it right the **** up. Thanks

Related

[Q] Reaching out for help on CM7 market issue

Well as I'm sure most of you know we released CM7 alpha for the NT on Sunday and it was very warmly received, even after a major bug was found it was still downloaded almost 2000 times by the time I eventually removed the files form download server yesterday (links were removed form thread at about 1200 downloads lol). The feedback is still extremely encouraging and people are itching for the next release.
We’ve been working hard on fixing everything so that the next version we release has a lot less bugs, we’ve fixed the main bug of formatting the xloader and we've fixed a handful over other things causing issue too.
The issues we are having now which we are struggling with are usb sync for media as well as sdcard to a computer (in another thread) and a more important one of market not being able to install larger games / programs if there is an sdcard in. For instance one that I use for testing is Zombie bash, if you have an sdcard in it just won't install.. We've looked up the error online and all the errors point towards deleting a certain file but the problem is that we don't actually have that file so it would appear we have a different issue!
So the time has come for Goncezilla and I to reach out and ask for help, somebody out there probably knows or can debug and find out what the issue is. We're stumped and we don't want to release the next version until that’s fixed!
So please, if anybody can help, drop me a Pm or say something on here and lets get CM7 next alpha version sorted and released !
Is there any way to get an error log of this issue? I am using an app called LogThis and nothing is shown in Logcat.
Probably totally unrelated but on the stock ROM I grabbed a couple of Amazon Freebies the weighed in over 50Meg's each. I wasn't even really interested in them so I carried on about my business and a couple of days later noticed that they never installed. After digging around the "error" was that I DIDN'T have an SD card installed. This struck me as weird because the 1GB user and 12GB B&N partitions should have certainly been enough.
Either way once I popped in an SD card the downloads automatically started and off I went.
Like I said .... probably useless information but I figured I would throw it out there.
arclite00 said:
Is there any way to get an error log of this issue? I am using an app called LogThis and nothing is shown in Logcat.
Click to expand...
Click to collapse
Good point, HERE is the logcat.
Mainly it would appear the errors showing are
E/Vold ( 1168): Error opening devmapper (No such file or directory)
E/Vold ( 1168): ASEC device mapping failed (No such file or directory)
and then a few lines on
E/PackageHelper( 2146): Failed to create secure container smdl2tmp1
E/DefContainer( 2146): Failed to create container smdl2tmp1
any help to anybody ?
I'm not too versed in the world of Android development, however this might be useful. LINK 1 LINK 2
Perhaps the permissions to the folders referenced in these articles are incorrect...
scsione889 said:
I'm not too versed in the world of Android development, however this might be useful. LINK 1 LINK 2
Perhaps the permissions to the folders referenced in these articles are incorrect...
Click to expand...
Click to collapse
Thanks for trying, that's one of the articles we found but unfortunately we couldn’t get anywhere with it
From the log it appears as though it is unable to create the smdl2tmp1 temp file. So wouldn't it make sense that it would either be permissions of the folder it's going in, or an issue with whatever is trying to create that temp file?
Have we tried not pre-packaging gapps with the ROM to see if that helps?
Quick question, is there a specific file size where the install fails\hangs? Ex installs are okay up to 9 meg files, but anything over, and it fails?
I want to try and download something and replicate the issue.
Disregard...
I had no problem installing Google Earth and other large apps (over 8MB) today, but cannot install Zombie Dash (only 4 and some change) moments ago. Not sure what relavence the size of the app might be having with the install issue...
Sent from my BNTV250 using xda premium
I found that the "/mnt/sdcard/.android_secure" folder has 000 permissions. The other folder mentioned in the links I posted (/mnt/secure/asec) has 075 permissions.
I compared this to my phone with fully functional market and found "/mnt/sdcard/.android_secure" has 000 permissions. The asec folder has 175 permissions. Perhaps the execute permissions is the problem? I am unable to change permissions in root explorer to test. I get the "some file systems (e.g. SD card) do not allow permission changes" message.
You considered posting on the Android development section? They may have some more info or guidance with this.
Sent from my Nexus S using Tapatalk
I'm not thinking it's permissions I think we've messed up and something isn't tuned on in kernel like driver mapper or asec.
Just been unable to find it. Although I'm speaking to somebody now and I think he may have hit on the cure
Okay...
"Size of container 7 MB 5392635 bytes"
I am assuming based on that, that the app is 7 meg?
D/Vold ( 1168): DEVPATH='/devices/virtual/block/loop0'
D/Vold ( 1168): DEVTYPE='disk'
D/Vold ( 1168): MAJOR='7'
D/Vold ( 1168): MINOR='0'
E/PackageHelper( 2146): Failed to create secure container smdl2tmp1
Okay, sp if you eject the SD card, the download works and installs. So that means when you go to download the app, it creates a temp file (same as when you download a file in windows via your web browser), and then once the download completes, the temp file is removed and you have an apk which is automagically installed via android app handler or whatever. IF the SD card is inserted, it tries to create the file on the SD card instead of internal memory. So the issues lies with the SD card itself possibly(?). Have you tried running checkdisk or some disk checking tool on your card? I have had issues in the past where my sd card got corrupted (once after running the partitioning tool in cwm) and I couldn't install large market apps. I ran checkdisk and found errors (i cant remember the exact msgs), but I repartitioned the card and all was well. It is possible with all the partitioning etc you have done to your cards, they have gotten a bit screwy, have you tried swapping out the SD card for a different one?
I just installed gun bros which is a 12meg app, with my sd inserted and mounted, with no issues...I tried to view it in logcat as soon as I hit download, but I didn't see anything pertaining to the market download and install =(
I already re-partitioned my card and went out and bought a new card to try. It's not that.
CWS - Glad to hear you're making some potential progress.
Well, I've done my best to collect info on the error, so based on what others have found, this seems to be what I've learned so far, including the obvious.
-The error we're seeing is "Couldn't install on USB storage or SD card."
-This error seems to have been most often encountered by people using Android 2.2 (Froyo) and derivatives because that version was related to reading a temporary file called "smdl2tmp1.asec." The user workaround in 2.2 was to browse your SD card using ES File Explorer (so that you can see .folders, which are normally hidden), finding the file in either:
/sdcard/.android_secure/smdl2tmp1.asec
OR:
/mnt/secure/asec/smdl2tmp1.asec
and deleting it.
-This apparently has been fixed in 2.3 (Gingerbread). Because Cyanogenmod 7 uses 2.3.4 as a base, it's odd that we're still having this problem then.
So in my exploration of this stuff, here's what I found:
/sdcard/.android_secure has ZERO FILES in it. Ditto for /mnt/secure/asec. On my HTC Hero, both contain plenty of files with .asec extensions. I have no idea what these files are for, but I'm getting the impression that the reason why these .asec files are not appearing has to do with how the current ROM is treating the SD card.
Also, the error doesn't seem to have anything to do with install size. I've tried to install Minecraft Pocket Edition before, it's only 1.57 MB but it will get the error regardless.
Keep in mind that I'm not a programmer, but this is all I've been able to gather.
---------- Post added at 05:52 AM ---------- Previous post was at 05:49 AM ----------
[/COLOR]
Mike_IronFist said:
Well, I've done my best to collect info on the error, so based on what others have found, this seems to be what we know so far, including the obvious:
-The error we're seeing is "Couldn't install on USB storage or SD card."
-This error seems to have been most often encountered by people using Android 2.2 (Froyo) and derivatives because that version was related to reading a temporary file called "smdl2tmp1.asec." The user workaround in 2.2 was to browse your SD card using ES File Explorer (so that you can see .folders, which are normally hidden), finding the file in either:
/sdcard/.android_secure/smdl2tmp1.asec
OR:
/mnt/secure/asec/smdl2tmp1.asec
and deleting it.
-This apparently has been fixed in 2.3 (Gingerbread). Because Cyanogenmod 7 uses 2.3.4 as a base, it's odd that we're still having this problem then.
So in my exploration of this stuff, here's what I found:
/sdcard/.android_secure has ZERO FILES in it. Ditto for /mnt/secure/asec. On my HTC Hero, both contain plenty of files with .asec extensions. I have no idea what these files are for, but I'm getting the impression that the reason why these .asec files are not appearing has to do with how the current ROM is treating the SD card.
Also, the error doesn't seem to have anything to do with install size. I've tried to install Minecraft Pocket Edition before, it's only 1.57 MB but it will get the error regardless. Of course, ejecting my SD card or unmounting it temporarily allows me to install the app, but that doesn't fix the bug, does it?
Click to expand...
Click to collapse
You think some apps check for those .asec files, and since they don't find them, it fails some kind of authentication and bombs out the installation?
Actually, I just checked my shift, and those folders are all blank as well. Hopefully whomever Celtic is talking to knows what's up.
stealthfx said:
You think some apps check for those .asec files, and since they don't find them, it fails some kind of authentication and bombs out the installation?
Click to expand...
Click to collapse
Yeah, essentially like that. Further down that rabbit hole is what Celtic mentioned:
CelticWebSolutions said:
I think we've messed up and something isn't tuned on in kernel like driver mapper or asec.
Click to expand...
Click to collapse
Apps don't seem to be creating .asec files anywhere, and it seems like some apps need .asec files to validate certain information. It seems to have less to do with the size of the app and more with whether or not the app needs to check an .asec file to install or function.
Mike_IronFist said:
Yeah, essentially like that. Further down that rabbit hole is what Celtic mentioned:
Apps don't seem to be creating .asec files anywhere, and it seems like some apps need .asec files to validate certain information. It seems to have less to do with the size of the app and more with whether or not the app needs to check an .asec file to install or function.
Click to expand...
Click to collapse
/dev/block/vold/179:17 /mnt/sdcard vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
sould be
/dev/block/vold/179:10 (< Check on that) /mnt/sdcard vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0002,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
also im looking into the fact that /device/virtual/block/loop0 does not exist.
stealthfx said:
Quick question, is there a specific file size where the install fails\hangs? Ex installs are okay up to 9 meg files, but anything over, and it fails?
I want to try and download something and replicate the issue.
Click to expand...
Click to collapse
I think the filesize problem is a red herring. It looks to be apps that have "'android:installLocation="preferExternal" in their apk manifest file.
Obviously this is probably used on larger apps more often so it looks like it is tied to the filesize. I have some small apps that give the same error.
Checkout http ://developer.android.com/guide/appendix/install-location.html for more info.
This doesn't necessarily help with the original problem but it might help limit the scope of troubleshooting.

[Q] MicroSD card read only after 4.3 update of Google Edition Samsung Galaxy S4

Hello,
Earlier today I got an OTA upgrade of my Samsung Galaxy S4 to Jellybean 4.3.
Everything is working great except for some reason my external SD card (A 64 GB SanDisk MicroSD) is read only. The only thing I can do with it is to format it. Otherwise all write operations to it fail.
I have tried two different cards and several different apps (Terminal, Astro File Manager for instance) and none of them can write to the device.
Is anybody else experiencing this issue or does anybody have any tip for how to solve it?
I am almost thinking it is a matter of a missing new permission but I can't find anything in the SDK docs about it (If this is the case that is fine because my main use of the card is a home made music player that I've written).
I have the same issue after updating to 4.3 yesterday - external SD card is mounted as Read Only after the update.
I have not seen it mentioned before, but It is quite possible that it is just part of the new "Google Experience" - Google has for a long time advocated having a single SD card and several of the tablet devices already had their external SD card mounted as read only in the past.
You can still write to it using MTP from a PC, but it is mounted as ReadOnly for the accounts that Android apps run on the device.
Of course it is possible that it is just a strange side effect (bug) in the upgrade process that is affecting only some devices.
pirin said:
I have the same issue after updating to 4.3 yesterday - external SD card is mounted as Read Only after the update.
I have not seen it mentioned before, but It is quite possible that it is just part of the new "Google Experience" - Google has for a long time advocated having a single SD card and several of the tablet devices already had their external SD card mounted as read only in the past.
You can still write to it using MTP from a PC, but it is mounted as ReadOnly for the accounts that Android apps run on the device.
Of course it is possible that it is just a strange side effect (bug) in the upgrade process that is affecting only some devices.
Click to expand...
Click to collapse
Well, in some way I'm comforted that I am not going insane here.
I will be calling customer support but in a perfect storm for some reason yesterday my Google Wallet account was "suspended pending validation" and it supposedly takes 2-3 days for Google to verify it and you can't get to the support number for Nexus and Google Experience devices without access to your wallet account .
If I learn something I will be letting you know.
same thing happened to me when I updated my s4 to 4.3 made the external SD card into read only cannot modify it using android only if I connect it with my PC. I called Google today they told me that they have not heard of this issue before but they forward the info to there technical people and they will respond back eventually for an email and hopefully a fix. but I am glad to see I am not the only one dealing with this. hopefully Google will get this issue fixed.
ES File Explorer works, so its not impossible for other apps to get updated to work.
I've been looking into this, trying to work around the issue in my own apps. Regrettably don't have a GS4 GPE, but working with users and searching have so far discovered the following:
The underlying problem is that in Android 4.3 (at least on the GS4 G.P. Edition), an application's UNIX user id needs to be part of the group "media_rw" in order to write to the removable "external" SD card.
The "WRITE_EXTERNAL_STORAGE" permission that almost every app out there uses is inadequate. That will get your app uid added to the group "sdcard_rw", which in the case of Android 4.3+GS4 G.P.E. is only good enough to write to the built-in storage.
The "WRITE_MEDIA_STORAGE" permission is required in order to have your app uid added to the group "media_rw". The problem is that this is a system protected permission. You can put this permission in your manifest, but you won't actually be granted it unless you're a system app. (Even tested this modification to FX File Explorer to make sure, and it still fails).
There does appear to be one solution available if you have root: modify the /system/etc/permissions/platform.xml file and grant the WRITE_EXTERNAL_STORAGE permission access to the group "media_rw". Source of this is here: http://forums.androidcentral.com/samsung-galaxy-s4-google-edition/303764-4-3-sd-write-access.html I have not personally tried this.
Issues with external SD
tliebeck said:
There does appear to be one solution available if you have root: modify the /system/etc/permissions/platform.xml file and grant the WRITE_EXTERNAL_STORAGE permission access to the group "media_rw". Source of this is here: http://forums.androidcentral.com/samsung-galaxy-s4-google-edition/303764-4-3-sd-write-access.html I have not personally tried this.
Click to expand...
Click to collapse
Hi!
I have the very same problem: some apps can access the external SD, some others do not.
I tried mount/unmount and root access in ES Explorer... but no way.
The freshly downloaded "Root Explorer" does have WRITE access to the ExtSD, but TBackup doesn't...
I am running Jamal 4.3 AOSP Rom on a EU i9505.
Any help is welcome!
Help! Got the same problem here
64gb samsung micro sd card. Always write protected and no other way to re-format it.
ivanslh said:
Help! Got the same problem here
64gb samsung micro sd card. Always write protected and no other way to re-format it.
Click to expand...
Click to collapse
This solution here helped me: http://forum.xda-developers.com/showpost.php?p=48702336&postcount=13
"I was having the very same problem. I finally went into the computer management, and was about to throw phone across room....when I tried to format one last time. This time I unchecked the quick format. It is taking longer, but seems to be working...I am keeping fingers crossed.
Full Format has finished and card is saved! Hope this helps anyone in the future."
tliebeck said:
There does appear to be one solution available if you have root: modify the /system/etc/permissions/platform.xml file and grant the WRITE_EXTERNAL_STORAGE permission access to the group "media_rw". Source of this is here: http://forums.androidcentral.com/samsung-galaxy-s4-google-edition/303764-4-3-sd-write-access.html I have not personally tried this.
Click to expand...
Click to collapse
I know this is almost 1 year old but... I was struggling with this issue for some days until I tried this and: :laugh:This is the solution!

[Q] ADB cannot push/mkdir/cp a file to extSdCard

Hi people, I have looked around and haven't found anything to do with adb not letting any editing to the extSdCard whatsoever (without root)
I want to be able to use
Code:
adb push "C:\whatever.txt" /storage/extSdCard/
and actually work. everytime I do this it gives me:
Code:
failed to copy 'C:\whatever.txt /storage/extSdCard/whatever.txt': Permission denied
I have not got superuser privileges and made this thread for those who do not have it. PLEASE do NOT post anything to do with busybox or su, your efforts will be in vain.
Thanks in advance
for those coming here as reference, this is probably due to the changes to file permissions in KitKat
The Jinxer said:
for those coming here as reference, this is probably due to the changes to file permissions in KitKat
Click to expand...
Click to collapse
No, it's not. The Kit Kat SD card deal is only for 3rd party apps on the phone for writing to the SD card. http://www.androidcentral.com/kitkat-sdcard-changes . Has nothing to do with adb.
There are tons of people through the past few years that have this "trouble" for various phones and many versions of android. Often times it does just not work. Are you certain that the external is at /storage/extSDcard? Sometimes you have to do this as well:
adb push somefile.zip /storage/extSDcard/somefile.zip
What phone do you have? Why to the external and not internal and then just use a file manager to swap it over? Or use an external card reader. Or wifi file transfer.
es0tericcha0s said:
No, it's not. The Kit Kat SD card deal is only for 3rd party apps on the phone for writing to the SD card. http://www.androidcentral.com/kitkat-sdcard-changes . Has nothing to do with adb.
There are tons of people through the past few years that have this "trouble" for various phones and many versions of android. Often times it does just not work. Are you certain that the external is at /storage/extSDcard? Sometimes you have to do this as well:
adb push somefile.zip /storage/extSDcard/somefile.zip
What phone do you have? Why to the external and not internal and then just use a file manager to swap it over? Or use an external card reader. Or wifi file transfer.
Click to expand...
Click to collapse
my phone's details are in my signature.
I do push to the internal since i cant push to external. my external is called sdcard1 by the system. The reason for pushing to external is that it is 16GB compared to 8GB internal (5GB usuable)
Why can't you just transfer via MTP or wifi file transfer?
es0tericcha0s said:
Why can't you just transfer via MTP or wifi file transfer?
Click to expand...
Click to collapse
I have an automatic script which moves files to the phone/installs them if apk file etc. MTP sucks big time and wifi can be slow/not available
The Jinxer said:
I have an automatic script which moves files to the phone/installs them if apk file etc. MTP sucks big time and wifi can be slow/not available
Click to expand...
Click to collapse
Never really had issues with MTP. I work on phones for a living and have owned many (see list in sig) and use 3 different PCs - Win XP, Win 7, and Win 8.1 and MTP works right 99% of time for me on - you name it - HTC, Samsung, Sony, LG, etc etc. Have rooted/modded/upgraded/fixed 100s of devices and pretty much all of them I have to use MTP these days. *shrug*
If you have the ability to wifi tether, you can tether to your device and send files that way too. It's as fast/reliable as your data connection at that point though. I'm lucky enough to live in an area where I have a good signal almost always and have unlimited data so this option works great for me too. Your results may vary.
i forgot to mention i am in a no signal zone. so wifi is not an option. i dont mean mtp does not work, but i feel it is sluggish and has flaws, while my script has none. do you want my script?
basically it is a drag and drop batch file, and if the dropped file is an apk, it installs it. if the file is a mp3, video etc it moves it to a corresponding folder, and if the extension is not recognised, it offers to move the file to downloads. only flaw it has is that it needs editing to work on a phone that names the internal sd something else, which can be changed with an easy find/replace

[Q] AppArmor rights to read from SD Card

Hello, I am developing an app for offline navigation, the development goes steady and a more or less usable app is ready now. I am just struggling with one thing, I now put the map files in <SD_CARD>/Pictures/osmscout and add picture_files_read to the apparmor file. Of course Pictures is not the right location for maps, but how can I give my app rights for another location on the sd card, like <SD_CARD>/Maps/osmscout or something?
The description of picture_files_read in the ubuntu-sdk apparmor dialog says that this apparmor profile should give read access to /media/*/r (at least temporarily) however it doesn't actually give me permissions to any other location than Pictures.
Any ideas?
Thanks
Ubuntu prevents file system access to any other location than your own data, cache and config directories by design. That decision was made to improve the security of the system.
However, as noted, you do have write access to three directories:
Code:
~/.local/share/package.name (for user data)
~/.cache/package.name (for caching)
~/.config/package.name (for config files)
The directory which would be best for your purposes would probably be the cache directory.
That one isn't located on the sd card but it's the only option you have.
Sent from my awesome Ubuntu Touch device using the Forum Browser app
Well, the cache directory is just in the home directory and probably not big enough. I don't even need write access, just read access for now, as the user is putting the files there manually.
Until I have found a workaround, I am putting the files in Pictures.
At least for the Aquaris, the home partition is too small to store any serious map files, they can easily be a few GB.
nikwen said:
Ubuntu prevents file system access to any other location than your own data, cache and config directories by design. That decision was made to improve the security of the system.
However, as noted, you do have write access to three directories:
Code:
~/.local/share/package.name (for user data)
~/.cache/package.name (for caching)
~/.config/package.name (for config files)
The directory which would be best for your purposes would probably be the cache directory.
That one isn't located on the sd card but it's the only option you have.
Sent from my awesome Ubuntu Touch device using the Forum Browser app
Click to expand...
Click to collapse
Sadly, I don't see many options here.
The only one which I can think of is the following: Ask your users to download the terminal app and copy over a command which either creates a (persistent) symbolic link from /home to their data directories on their sd cards or mounts the said folders in their home directories (the latter wouldn't be persistent after a reboot).
You still have to check out if that works but I'm confident that at least the mount scenario works.
Otherwise, I believe this would be a good question for the Ubuntu Phone mailing list where the OS developers hang out, too: http://launchpad.net/~ubuntu-phone.
Sent from my awesome Ubuntu Touch device using the Forum Browser app

microSD card access in Android Apps

Hello,
I'm considering purchasing the Samsung Chromebook Plus when it gets released and I don't to get anything wrong considering I live in the EU and will be importing it from the USA shall I decide to make this purchase. What finally pushed to towards purchasing a Chromebook is Android Apps and Play Store availability. However, as I understand, the only folder Chrome OS and Android actually have in common and can both access in the Downloads folder, which means no access to microSD card. In any case, if a purchase a chromebook, I plan to put it in Developer Mode, for multiple reasons among which is the ability to install a APK. My question is : is it possible, when in Dev Mode, to create a symlink (the way you create a symlink in *NIX systems) in the Downloads folder that leads to the microSD card and access the external storage from Android Apps (one of the main reason I want to do that is sync Dropbox and OneDrive files to the microSD) ? I thought I read it was possible sometimes in late 2016 but I can't seem to find it anymore.
Thanks in advance for your help.
There's a way to mount it as read only: http://nolirium.blogspot.com/2016/12/making-sd-card-content-accessible-to.html
Or if you get root within the android application it may work: http://nolirium.blogspot.com/2016/12/android-on-chrome-os-rooting-shell.html
Wow thanks! That's not even very difficult (at least for read access). Only problem is when suspending. Maybe that could be solved by automating the process!
Do you know if it is possible to manually mount ext4 sd cards in chrome os ? I just thought you might be unable to write due to folder ownership but maybe setting it manually would help.
Do you what the unix username of Android user is ?
EDIT: there is so little information about it that I believe I'll have to try it out myself

Categories

Resources