I have a rooted device and I want to change the permission to the folder 'com.android.mms'. My app is system app. Is there a way to do it?
I have already tried using process and checked this link as well.
How to get File Permission Mode programmatically in Java
They don't throw any error but doesn't do the job as well. Can someone help? Thanks!
Related
I am working on a android app and i want the user to be able to view the folders that require root access. I tried looking through the Cyanogenmod file manager code to try and trying the su command in java with the Runtime thing, but I had no luck.
You cannot do this without rooting the device (which simply means gaining required root access level). That's basically the reason for permission system - to keep you away from the places you should not be looking in.
I have a Google Nexus 7, and I've been developing on it. Only recently, however, have I become unable to access the /data/ directory using the file browser in eclipse. The device was never rooted, but now since I upgraded it, I believe that I have lost access to this. Is there any way to get eclipse to use the "run-as" command to access my app's data directory? How come I have suddenly lost access to this?
Is the only option left to root the device?
Thanks
Is there any way to get eclipse to use the "run-as" command to access my app's data directory?
There is nothing for you to run "as" that would help here, AFAIK.
How come I have suddenly lost access to this?
You should not have had access to it in the first place. If you did, that was a security flaw in the device, perhaps fixed by a firmware upgrade.
Is the only option left to root the device?
You could not browse the /data/ directory on production hardware. For example, you can browse /data/ on the emulator.
I am able to given root permission by installing apk.
http://gadgets.ndtv.com/mobiles/features/how-to-root-nokia-x-and-get-access-to-google-play-store-and-google-now-508391
I’m trying to create an app that is able to access and modify a protected database within /data/data/. This process obviously requires root privileges and I am testing this on a rooted device. The general code to access the SQLite database is complete and works against a test database that is located elsewhere (on /sdcard/).
However when I want the application to access the database within /data/data/, it obviously fails as I am trying to access it as a normal user. I have read on the topic of using the su binary on Android for a bit now, and as far as I understand it usually used to execute shell commands only.
So my initial idea of making this work was to simply change the permissions of the file when the application starts, and change it back when it quits. So before actually bothering with implementing that in the application itself, I used my file explorer to change the permission to rw-rw-rw-. However my application was still not able to open the database.
My next idea was to use the sqlite3 program directly from the shell, but I found out, that my ROM does not come with it, so I would have to distribute it myself (Titanium Backup seems to do that).
However there is something that makes me wonder if there might not be a better way: I am using Root Explorer as my file explorer and it has a built-in way to browse any SQLite database. Given that it does not seem to ship with a custom sqlite3 binary, and that my phone does not have one itself, the access seems to happen using the normal Java tools. But how does the app get root rights then?
Is there a way to make an Android application run as root? Or did I forget setting something for the permissions earlier which prevented me from accessing it? Or does anyone know how Root Explorer does it?
You cannot raise the permissions of an already running process as far as I know. The simplest answer would be to copy it somewhere using the root shell / command line edit it, then copy it back as root again. And yes, I did read your question, just didn't explain the answer fully. Hopefully it's clear now. Not sure if root explorer does that or something else, but it would work.
I am new to android programming so I will be really grateful if someone helps me.
I am trying to implement steganography in android but my problem is I don't know how to insert images in android. Because of which I am getting "No media found". Please help me with this.
I tried
c:> adb push c:\image1.png /sdcard/image1.png
But I get this in the Command Prompt.
failed to copy 'c:\image1.png' to 'sdcard/image1.png' : Read-only file system
I had the same problem, so in case anyone lands on this page here is how I solved it
When creating the emulator device (I use IntelliJ IDEA) - do not forget to move the radio button on SDCard option to the Size option, and specify the needed size, this way a new SDCard will be created and mounted to the emulator. In eclipse there are some command line parameters you can pass (or something else, I am not sure, since I read it only on the stackoverflow).
After that I stopped receiving the "Read-only file system" error, but I tried and tried and tried copying the files to the sdcard using:
adb push image.jpg /sdcard/image.jpg
or
adb push image.jpg /mnt/sdcard/image.jpg
but was receiving "No media found" error in my app or when I went to the gallery.
So I went to Dev Tools on the emulator applications, then to the Media Scanner. It quickly scanned the sdcard, and boom - I finally got to see my images.
Hope this helps :)
The correct directory for my emulator is mnt/sdcard. This works for me:
adb push README mnt/sdcard
Also note that you can explore directories using adb shell ls <path>, which might have tipped you off to the right path.
Edit - apparently sdcard is a symlink to mnt/sdcard and works for me as well. Using a file named image1.png is also working. Maybe there is a problematic file already located at that location for you?
Edit 2 - I think you also need to have the USB mounting option turned off when you use adb to push files. It sounds like you have this on given your comment about the gallery not finding your media.
I am writing an app to monitor some files under /sys/devices/.../cpu. There is one file that is owned by root:root, with only read permissions for root.
I added code to exec("su"), but even then I get a file not found exception. The only way I don't get an error is if I chmod the file permissions. However, these permissions get set back to root read after boot, so I'd really like to find how to do the read without changing the file perms.
Thanks,
Jim
I was able to do this following the code here: http://code.google.com/p/market-enabler/source/browse/branches/MarketAccess/src/ru/org/amip/MarketAccess/utils/ShellInterface.java. Jim