开发者

Enable/Disable GPS from Android CLI

Is it possible to enable or disable the GPS from the Android command line/terminal (not from Java source). Im ok with开发者_运维百科 the solution requiring root privs, as I understand there are security issues with random apps enabling the GPS against the user's wishes. I see a "run-as" command on my EVO, but can't find much about the command to see if that would be useful.

Edit: I guess a more "generic" form of the question is this: Can I run a particular app (davlik vm ) as any particular user if I have root privs? The system included widget to switch on/off GPS works because it runs as the same user as the system. Could I have my own app run as the system user in some way?


Google's response was that they don't offer uniform documented APIs for such things. Given that each process should be a Java process (and only libraries are allowed to be created in native code), they offer that your C++ library calls back Java code if it (C++ code) needs to access phone resources. Whatever you find, will be undocumented and without any guarantees to work on other devices or in future versions.


One place to start looking is in /sys/devices/platform. I cannot say anything specific about other phones but in my HTC myTouch 3G I have some control over hardware in there. In basic hacking around I found I could control my phones lights/leds, some control over the wifi and view info on most of the hardware. Depending on your phones GPS chipset (more specifically its driver) you might be able to enabled it from the shell.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜