开发者

Can I change write access for root directory? Sygic Navigation and their API

开发者 https://www.devze.com 2022-12-17 05:52 出处:网络
I need to be able to write textfiles to the root directory of my Android device (as this related questions开发者_如何学JAVA explains).

I need to be able to write textfiles to the root directory of my Android device (as this related questions开发者_如何学JAVA explains).

Can I change write permissions for root directory / and if so, how?

I tried pushing a file using adb, but it said file system was read-only =(

Its pretty annoying that I cannot control my own device, that everything is so restricted =(


EDIT 1: This thread has evolved into discussing Sygic Navigation and their API, which seems to be wrong when it comes to the Android platform. I have some other questions that discuss Sygic and their navigation software.


Only if you have root access.


This worked with me:

mount -o rw,remount -t rootfs /

Got it from here: http://www.pocketmagic.net/?p=757


Not by default. The root filesystem shipped on official Android devices is read-only, and only certain well-constrained areas are writable by applications. There are root exploits for many Android devices available, however, which allow you to do whatever you want to your filesystem.


If you want to get creative and bypass the (idiotic) / requirement without root privileges, you could use fakechroot, an LD_PRELOAD library from debian.

Edit: this is probably impossible for a java program, due to the way vm instances are forked out. A native program would have to contend with an unhelpful linker (no LD_PRELOAD), but if arbitrary programs can be started, an alternative linker won't need root privileges.


the ROOT is called that for a reason, the ROOT user is called that for the same reason. Anyone other than ROOT that owned / would be wrong and violate every UNIX principal of security. You can't do this for a GOOD reason, trying to do this is BAD.


I've had a quick look at the Sygic API Documentation. It does indeed say that input files come from the root directory. It also says that output files will be placed in the root directory. It even puts "root directory" in bold so you know that they're really serious that this is where the data files go.

As has been discussed, no Android application will have permission to write to this directory on a standard phone, so the Sygic documentation must be wrong. My guess is that this is the behaviour for other platform Sygic runs on but they haven't updated the documentation for Android.

I would hope they accept data via an Intent rather than a file, but without proper documentation is hard to know what you can do.

The API documentation does mention .out and .event files. Perhaps have a look around the file system on your device and see if you can find any. If you can, the .in files probably go in the same directory.


You say 'The application reads and parses the .in file when it's placed in root directory on the mobile device.'

I highly doubt this application is able to read the true root directory of your phone. I think it may be the root directory exposed to it over usb mass storage, aka /sdcard/.


Short answer: No you can't.

Long answer: No you can not, and should not.

Rant:


I am sorry that you may dislike some of the answers you are receiving here, but they are not as you put it 'smart remarks' (well they are smart, but not smart alec).

Instead what you are seeing is other developers, likely with more experience on the platform, giving you genuine warnings and good advice. They are warning you that the path that you are on reflects some poor design decisions.

You stated that:

Im using an external app that I have no control over whatsoever, and according to their API: The application reads and parses the .in file when it's placed in root directory on the mobile device. And there we have the reason why I dont save the file anywhere else and I cannot "review" my design

But commonsware.com is exactly right when they say:

Then stop using that "external app", whatever "external app" means. It clearly isn't an Android APK, as they wouldn't be shipping something that required the ability to write to the root directory.

Additionally, you commented in frustration that:

Yes, unfortunately "rooting" every device that is to use this solution is probably not an option =( Damn, every single thing I try to do in android doesnt work for this or that reason =(

There are so many reasons that the Android OS does not and should not allow every developer and their grandmother to have full control over root/system directories, but instead of listing some off the top of my head I will ask you this (rhetorically):

Why even bother having access control, and permissions, if any piece of software could change those settings whenever it feels like doing so?

I for one would never feel comfortable downloading an application for my smartphone if I knew it could have the ability to thrash about my entire device like a drunken elephant.

I could keep ranting but I will stop myself here...

0

精彩评论

暂无评论...
验证码 换一张
取 消