[Q] How do I access android.os.storage.IMountService? System Dev's HELP! - Android Q&A, Help & Troubleshooting

I'm working on a custom tablet running Android 6.0.1
I have root access and have placed the app I'm making in the /system/priv-app/ directory and thus gaining access to system permissions.
This app needs to copy files from the sdcard partition to a flash drive (The tablet I'm working on has 2 Full USB ports) and then unmount the flash drive.
I've already got the file's being copied successfully, but I'm having trouble unmounting the flash drive.
From what I've read I need access to the android.os.storage.IMountService class.
How do I gain access to this class?
I've tried adding a classes-full-debug.jar file I found online and this did give me access to android.os.storage.IMountService but there were errors when trying to compile in Android Studio.
The main reason this tablet even exists is to create these reports and the people using these tablets are not very "Tech Savy"...
Simplifying the process to get the reports off the tablets is crucial, so any help at all would be amazing!

Habbert said:
I'm working on a custom tablet running Android 6.0.1
I have root access and have placed the app I'm making in the /system/priv-app/ directory and thus gaining access to system permissions.
This app needs to copy files from the sdcard partition to a flash drive (The tablet I'm working on has 2 Full USB ports) and then unmount the flash drive.
I've already got the file's being copied successfully, but I'm having trouble unmounting the flash drive.
From what I've read I need access to the android.os.storage.IMountService class.
How do I gain access to this class?
I've tried adding a classes-full-debug.jar file I found online and this did give me access to android.os.storage.IMountService but there were errors when trying to compile in Android Studio.
The main reason this tablet even exists is to create these reports and the people using these tablets are not very "Tech Savy"...
Simplifying the process to get the reports off the tablets is crucial, so any help at all would be amazing!
Click to expand...
Click to collapse
can't you just open a shell in the background of the app and do df -h and see what the drive mount thing it is on, then you can just type unmount /dev/<insert drive mount thing here>.

if anyone else has this problem the solution is http://stackoverflow.com/a/39792666/5194446

Related

[Q] How to move app data to another device

Here is my situation. I am on vacation and I am using 3g with my laptop to access the internet and ad-hoc wifi to connect the G-Tab. Me wife has a 7" black Pandigitial Novel (android 1.5, rooted and set so Market thinks it is 1.6) and it does not support ad-hoc wifi. She has a crossword puzzle app (Shortyz) that she can not update with new puzzles. I have downloaded the app and the new puzzles. Now, how do I get it to her device? I thought I could move it (only the new data part) to the external SD card and then pull it and put it in her device and she could move it from there. Then I realized that App2SD only moves to the internal SD card. So, now I'm stuck as what to do. Is there an app that will allow me to move data to an external SD card or some type of work around? Could I download it to the laptop and then put it on the SD card? Thanks
If you already have Shortyz installed on your gTab, its crosswords, updates and WIP files should be in /mnt/sdcard/crosswords/.
If your wife also has the app installed, then you can just copy the contents of that directory to the (same?) directory on the Pandigital.
If you also have to update her app, then you'll have to copy your apk file and overwrite her version on the Pandigital.
All this is slighty tricky if you don't know the app locations--on the tablet/moved to SD card/USB storage--on both your and your wife's tablets. Try this command as a starting point for sniffing out the locations (on both tablets):
Code:
gTablet$ [B]su[/B]
gTablet# [B]find /data -name *totsp*[/B]
I assume I can use Terminal Emulater to do the sniffing on the G-Tab. Is the transfer done via USB between the two tablets or do I have to use me laptop? You will probably have to walk me through this if it is okay with you, I have only been activily working with android for about two months. Thanks
UPDATE: Using a app "Sniffer" I found the different puzzles that was downloaded for Shorthand on the G-Tab but I do not have "Sniffer" on my wife's or Terminial Emulator. I do have a couple of file managers if they could be of use. Also, how will I overwrite the data that is already there(on the Pandigital)?
I may have over-complicated your reply. I do not have to update my wife's Sportyz, I only need to update the puzzles. How would I do this between devices. Both devices have DropBox but, I have only used it to install apk files I have downloaded to my pc and Thanks put in the DropBox. Thanks
lartomar2002 said:
I do not have to update my wife's Sportyz, I only need to update the puzzles.
Click to expand...
Click to collapse
Then it's very simple (if, potentially, a bit tedious). Copy the entire tree (all files and directories) from /mnt/sdcard/crosswords on your gTablet to your wife's crosswords directory--after you locate where that dir. is on the Pandigital.
How you make the copy is up to you. Zipping up the whole directory on your gTablet, sending the file to your wife and unzipping it in the proper place on the Pandigital will be the easiest. If you can't zip things up for any reason, you'll have to transfer each file individually after creating the correct directories. You can use Dropbox, email, ftp, SD cards, USB sticks, ... to transfer the file(s). You mentioned that the Pandigital didn't support ad-hoc WiFi. If you're near any kind of public access point, use that to get networking going on both devices then.
Use your imagination. At least one of you likes solving puzzles. Think of this problem as one. Best of luck.
Thank you, While waiting for your response I did exactly as you have suggested. I zipped the directory and put it on my SD2, then put it in my wife's tab and unzipped it to the proper directory.

How do I install apk from Terminal Emulator from my Android Phone running JellyBean ?

Hello,
Here is the short story.
I have Samsung Galaxy ACE which is rooted.
Till y'day I was using CM9 Beta 8 ICS 4.0.4 and it was working well.
I installed CM10 JB for Galaxy Ace alpha1 from "hxxp://maclaw.pl/?page_id=180#comment-3642"
Now the problem is, JB doesn't have File Manager installed and I need to install TB to revert my backups.
Due to some unknown reason I am not able to access internet on my device either through GPRS or 3G connection.
I am desperately looking for a way to access my SDCARD wherein I have all my apk's which I can install however, without File Manager I am not sure how to install an apk.
I did some google search and came across topics about installing apk using Android SDK etc.. however I would not want to work on SDK as I feel its bit tedious job for me.
I also tried Android Injector however that didnt work even if I have enabled USB debugging Mode for adb + apps.
Now, I am hoping that, I can use the Terminal Emulator which is preinstalledo n my phone to install apk present on my sdcard.
However, I am not sure how to do that, It would be really appreciated if anyone can suggest the steps to install apk present on my sdcard from Terminal Emulator available on my phone.
Here are some of the screen captures
http://imageshack.us/photo/my-images/855/screenshot2012072418240.png/
http://imageshack.us/photo/my-images/52/screenshot2012072418234.png/
http://imageshack.us/photo/my-images/822/screenshot2012072418230.png/
Thanks
Never mind...
I managed to install Astro File Manager apk from Terminal Emulator.
For those who are interested, here is what I had done.
Previously, I wasn't able to browse sdcard contents from TE,
I rebooted my phone once, fired up TE again
~Android$ su
Allow root access for TE
~Android# cd sdcard
~Android# ls ( Contents of SD card are listed ) I had copied astrofm.apk on root of SDCARD
~Android# pm install astrofm.apk
Success !
Thanks
P.S. This thread can be closed.
@@
hsotnas said:
Never mind...
I managed to install Astro File Manager apk from Terminal Emulator.
For those who are interested, here is what I had done.
Previously, I wasn't able to browse sdcard contents from TE,
I rebooted my phone once, fired up TE again
~Android$ su
Allow root access for TE
~Android# cd sdcard
~Android# ls ( Contents of SD card are listed ) I had copied astrofm.apk on root of SDCARD
~Android# pm install astrofm.apk
Success !
Thanks
P.S. This thread can be closed.
Click to expand...
Click to collapse
Awesome guide !!!! , thanks bro !! :good::fingers-crossed:
Thank you for the guide
it works. thank you
works, thanks
hsotnas said:
Never mind...
I managed to install Astro File Manager apk from Terminal Emulator.
For those who are interested, here is what I had done.
Previously, I wasn't able to browse sdcard contents from TE,
I rebooted my phone once, fired up TE again
~Android$ su
Allow root access for TE
~Android# cd sdcard
~Android# ls ( Contents of SD card are listed ) I had copied astrofm.apk on root of SDCARD
~Android# pm install astrofm.apk
Success !
Thanks
P.S. This thread can be closed.
Click to expand...
Click to collapse
I very much appreciate the quick tutorial!
However, with that being said, I am having an issue trying to install my .apk onto my Motorola Xoom (Rooted running CM10.1) through the use of Terminal Emulator. I first tried installing the .apk from my File Manager and just clicking on the icon, and clicking Install, like one would think one should be able to do. When that method failed, multiple times(kept saying "insufficient storage, please delete files through app manager") which by the way, I know for a fact I have 15.8GB of storage left on my Xoom, so this should not be the issue. I then decided to try and install through Terminal Emulator. Now one would think it would be about the same as using adb commands on a Computer, which it somewhat is I guess you could say. So I go to T.E. and type the commands to get Super User access, then cd sdcard to go into the directory, then cd download because this is where my file is located, then I type pm install ****.apk.
I get a line of command that says: a) pkg: ****.apk and then b) Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE], and then the command line just goes back to my download folder directory.
I've had this issue before on my Galaxy S3, but can't remember how I ended up resolving the issue. Think I did a factory data reset/wipe, which I don't want to have to do to my Xoom. So any assistance would be much appreciated. I do understand that your device was a Galaxy ACE, but I wouldn't think it would matter as to what the device is, since it is the same install method/command for any Android device essentially. Hope someone can help out. If not, I may have to post in another Device Thread (Motorola Stingray Xoom I would assume).
Many thanks in advance, and I will click the Thank You, if any responses come through.
Really appreciate for the guide man
Sent from my LG-P700 using xda app-developers app
Thanks for the reply... short, to the point, and it works.
DannyShane said:
I very much appreciate the quick tutorial!
However, with that being said, I am having an issue trying to install my .apk onto my Motorola Xoom (Rooted running CM10.1) through the use of Terminal Emulator. I first tried installing the .apk from my File Manager and just clicking on the icon, and clicking Install, like one would think one should be able to do. When that method failed, multiple times(kept saying "insufficient storage, please delete files through app manager") which by the way, I know for a fact I have 15.8GB of storage left on my Xoom, so this should not be the issue. I then decided to try and install through Terminal Emulator. Now one would think it would be about the same as using adb commands on a Computer, which it somewhat is I guess you could say. So I go to T.E. and type the commands to get Super User access, then cd sdcard to go into the directory, then cd download because this is where my file is located, then I type pm install ****.apk.
I get a line of command that says: a) pkg: ****.apk and then b) Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE], and then the command line just goes back to my download folder directory.
I've had this issue before on my Galaxy S3, but can't remember how I ended up resolving the issue. Think I did a factory data reset/wipe, which I don't want to have to do to my Xoom. So any assistance would be much appreciated. I do understand that your device was a Galaxy ACE, but I wouldn't think it would matter as to what the device is, since it is the same install method/command for any Android device essentially. Hope someone can help out. If not, I may have to post in another Device Thread (Motorola Stingray Xoom I would assume).
Many thanks in advance, and I will click the Thank You, if any responses come through.
Click to expand...
Click to collapse
Hi DannyShane,
Not sure if this is still relevant and you are around here, since it's been a very long time and I stopped using Android
I am not an Android geek but here are my 2 cents...
You need to keep .apk file on the root of the SD CARD instead of a folder. IIRC, I had the same exact error which you had mentioned, I was trying to install .apk which was placed in a folder and it didnt work., then I had to move the .apk file to root and it worked flawlessly.
Extremely sorry for the very late response though. I use my secondary e-mail for this forum and missed replies on this thread.
@ All others who have replied, I am glad that, my little finding helped you guys.
Cheers :angel:
I have a few things to add to hsotnas answer. The insufficent space error seems to be a very generic error on android that can have various causes. Maybe there is something like this in the android source code:
PHP:
try{
installApk();
} catch (Exception ex){
output("Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]");
}
If you understand what I mean
I had this error myself a few days ago and for me it was caused by some left over files in the /data/app-lib directory. It was a self-developed application and I added a library to this directory manually. As I uninstalled the application, it wasn't removed and the reinstall failed with the above mentioned error. So make sure the directories /data/data/app.package.name/ and /data/app-lib/app.package.name/ are empty.
I tried this, to install the play store apk. But I get the error INSTALL_FAILED_INVALID_URI. What is this error refering to?
PSV_Supporter said:
I tried this, to install the play store apk. But I get the error INSTALL_FAILED_INVALID_URI. What is this error refering to?
Click to expand...
Click to collapse
Me too same thing happens when I try to install 3.apk
the command used is "pm install apps/*.apk"
Mine are backups of play store
Thankyou for this tutorial... IT WORKS.. Can't believe it.. You made my day. Thankyou :good:
I'm trying to recover an old tablet and need to install a file manager... the touch screen inst working so I thought terminal would do the job... but .APK's dont show when I go to the root of the SD card and type 'ls'
An ideas?
Thanks it works
failed on me ..

Wi-Fi does not work and system directories stuck on "read only" in RemixOS 3.0

Wi-Fi does not work and system directories stuck on "read only" in RemixOS 3.0
Hello to all the community Xda RemixOS.
Updating my macbook to RemixOS 3.0 version of the wi-fi does not work properly. In practice, the only way is to connect the LAN cable. On external forums I found the solution: change some strings of code init.sh files located within /system/etc/init.sh. To my great surprise, however, despite the root permissions I can not edit files in this directory because only mode "reading." I tried to mount terminal system even in writing, but the result is: "/ dev / loop1 / system is read-only mode." I have root permissions in theory I could not do what I want in those directories ??
Anyone able to help me places urgently, thank you!
Luke_99 said:
Hello to all the community Xda RemixOS.
Updating my macbook to RemixOS 3.0 version of the wi-fi does not work properly. In practice, the only way is to connect the LAN cable. On external forums I found the solution: change some strings of code init.sh files located within /system/etc/init.sh. To my great surprise, however, despite the root permissions I can not edit files in this directory because only mode "reading." I tried to mount terminal system even in writing, but the result is: "/ dev / loop1 / system is read-only mode." I have root permissions in theory I could not do what I want in those directories ??
Anyone able to help me places urgently, thank you!
Click to expand...
Click to collapse
look in the remix forum for the tutorial on how to enable system rw capability. after that you should be good to go.
look here: http://forum.xda-developers.com/remix/remix-os/guide-modify-remix-3-0-101-t3428553
Yes, read the above guide, it's all you need + the wifi guide you've already found.
Please use search or simply check the top threads.
Every day too much stuff is duplicated, we must avoid it in order too keep the forum clean.
Sent from [email protected] 4
excuse me but I was not able to find anything. I probably had not looked good. Thank you
Wrong topic
Luke_99 said:
Hello to all the community Xda RemixOS.
Updating my macbook to RemixOS 3.0 version of the wi-fi does not work properly. In practice, the only way is to connect the LAN cable. On external forums I found the solution: change some strings of code init.sh files located within /system/etc/init.sh. To my great surprise, however, despite the root permissions I can not edit files in this directory because only mode "reading." I tried to mount terminal system even in writing, but the result is: "/ dev / loop1 / system is read-only mode." I have root permissions in theory I could not do what I want in those directories ??
Anyone able to help me places urgently, thank you!
Click to expand...
Click to collapse
http://forum.xda-developers.com/remix/remix-os/guide-modify-remix-3-0-101-t3428553

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

Android 10 Browser ERR_ACCESS_DENIED error accessing file:///storage/emulated/0/...

I've just had a stock OnePlus Nord N10 running Android 10. For years now I've kept a html file on the internal storage of my Android devices that I've used as a homepage for my web browsers that have all my favourite links laid out nicely. On my older OnePlus 3 running Android 8 I open this using the following URL in the browser url bar:
file:///storage/emulated/0/Dropbox/Other/Web_Links.html
And it opens fine.
On the Nord N10 it is failing with an ERR_ACCESS_DENIED error in the browser. I'm getting this in both Chrome and Edge. The URL appears to be correct (typos give me a file not found error) so I'm at a loss to know what's causing this. It feels a bit like the browsers aren't asking for the right permission to open files from file:///storage/emulated/0/ but I don't know how to get them that permission.
If I open the file from a file browser sending it to the web browser it opens fine, but gets a url in the form of content://media/external/file/39531 in the url bar only that url seems to only last until the next reboot.
Just to muddy the waters more - I had a couple of Moto G 5G Plus's running Android 10 a couple of months back that had to be returned because I just couldn't get a decent 4G signal on them and I had the same issue on them, but did "something" and got it working for the file:///storage/emulated/0/... url. Only I wasn't sure even at the time what I did to get it working.
Any help would be appreciated. Even if it's a dummy's guide to how apps relate to file:///storage/emulated/0/ and what specific permission they need to access it.
Hal18ut said:
I've just had a stock OnePlus Nord N10 running Android 10. For years now I've kept a html file on the internal storage of my Android devices that I've used as a homepage for my web browsers that have all my favourite links laid out nicely. On my older OnePlus 3 running Android 8 I open this using the following URL in the browser url bar:
file:///storage/emulated/0/Dropbox/Other/Web_Links.html
And it opens fine.
On the Nord N10 it is failing with an ERR_ACCESS_DENIED error in the browser. I'm getting this in both Chrome and Edge. The URL appears to be correct (typos give me a file not found error) so I'm at a loss to know what's causing this. It feels a bit like the browsers aren't asking for the right permission to open files from file:///storage/emulated/0/ but I don't know how to get them that permission.
If I open the file from a file browser sending it to the web browser it opens fine, but gets a url in the form of content://media/external/file/39531 in the url bar only that url seems to only last until the next reboot.
Just to muddy the waters more - I had a couple of Moto G 5G Plus's running Android 10 a couple of months back that had to be returned because I just couldn't get a decent 4G signal on them and I had the same issue on them, but did "something" and got it working for the file:///storage/emulated/0/... url. Only I wasn't sure even at the time what I did to get it working.
Any help would be appreciated. Even if it's a dummy's guide to how apps relate to file:///storage/emulated/0/ and what specific permission they need to access it.
Click to expand...
Click to collapse
If device's Android is rooted try this
Code:
adb devices
adb shell "chmod 0644 /storage/emulated/0/Dropbox/Other/Web_Links.html"
jwoegerbauer said:
If device's Android is rooted try this
Code:
adb devices
adb shell "chmod 0644 /storage/emulated/0/Dropbox/Other/Web_Links.html"
Click to expand...
Click to collapse
It's not rooted, and I don't really want to root it. The Moto wasn't rooted either.
Does Android do anything "odd" with permissions when copying files around that might be causing this? It was copied in from a memory card.
Hal18ut said:
Does Android do anything "odd" with permissions when copying files around that might be causing this? It was copied in from a memory card.
Click to expand...
Click to collapse
By default, when you create a file as a regular user, it’s given the permissions of 644 ( means: rw-rw-r– ). These permissions don't get stored with the file but within the filesystem where the file is located. Hence when you transfer a file from one filesystem ( here: external sd-card ) to another one ( here: internal sd-card ) , the initially granted permissions get lost.
jwoegerbauer said:
By default, when you create a file as a regular user, it’s given the permissions of 644 ( means: rw-rw-r– ). These permissions don't get stored with the file but within the filesystem where the file is located. Hence when you transfer a file from one filesystem ( here: external sd-card ) to another one ( here: internal sd-card ) , the initially granted permissions get lost.
Click to expand...
Click to collapse
Any tricks for copying (or moving the file) so it gets the correct permissions? Also, any non-root way of viewing them to confirm this is cause of the issue?
The best I've come up with so far is to save the .html files in Android/data/com.microsoft.emmx/files/Download/ and then reference them with file:///storage/emulated/0/Android/data/com.microsoft.emmx/files/Download/Web_Links.html which appears to work. Presumably substituting com.android.chrome for com.microsoft.emmx will work for Chrome.
Still don't understand why Edge and Chrome don't have access to URLs via file:///storage/emulated/0/ nor how I got around this on the Moto.
There might possibly be another way, but I cannot recall the details on how to do it or whether it requires root or not. Some devices have special internal URI's that enable, e.g., debug mode, which can be invoked via omnibox in the form of in-line commands. I remember in particular my car's Android head unit had this for it's native browser and after enabling debug mode,. I was able to browse `file:///` and its subdirectories. My unit did have root at the time, but I want to say that regardless this wasn't accessible without the debug command being enabled, so I would infer it might not require root (but that's purely conjecture). This is not a persistent state, but the command could be saved as a bookmarklet for ease-of-use. I've never looked into whether this is a common or unique Android function, or something the OEM developed.

Categories

Resources