tags:

views:

393

answers:

2

Is it possible (without violating any licenses) to write a native C/C++ application on top of the Android OS and make it run as a daemon process?

There are already several daemon process' running which one can see with the 'ps' command, the legal part concerns me the most. And also the lack of documentation on how to exactly do this.

For the writing part, I guess one could use basic Linux programming concepts, since Android supports at least to some level the standard Posix API. To make it run as the phone boots, some modifications is of course required in init as well.

I have no plans to have this app in the Android Market, so installing it manually to the phone is not a problem. As long as it does not require re-compiling the whole OS or kernel.

I really appreciate all info on this topic, since there's isn't much available.

Thanks.

+1  A: 

Legally it's not a problem at all, they're not Apple.

The application fundamentals explain how to do that in java, the NDK explain how to do stuff in C/C++, I guess you can somehow figure it out.

Lo'oris
Thanks for the reply.I don't see how the application fundamentals article helps me on this matter. It does discuss about services, but I'm talking about something running in the lower level.The NDK seems to offer a way to bundle C/C++ written code inside the apk files. These are always executed/used by the Dalvik VM. What I need is a background process running directly on top of the OS, on the same level as the ddmd, for example.For legal issues, I'm concerned about hacking the init process or some of its rc etc files.
J Andy
Quote from NDK's page"Please note that the NDK does not enable you to develop native-only applications. Android's primary runtime remains the Dalvik virtual machine."
J Andy
I'm sorry, I didn't understand you wanted to bypass everything, I thought you just wanted to create a Service using C. I guess what you want to do is just not possible with the standard ROM (not sure, though).
Lo'oris
NP, I guess my question wasn't that clear in the first place. Thanks for the help.
J Andy
+1  A: 

Is it possible (without violating any licenses) to write a native C/C++ application on top of the Android OS and make it run as a daemon process?

Not cleanly.

And also the lack of documentation on how to exactly do this.

Because you're not supposed to be doing this, except by modifying the firmware.

To make it run as the phone boots, some modifications is of course required in init as well.

Which will only be possible on a rooted phone (at best) or via modifying the firmware (at worst).

Android's NDK is designed to create libraries to connect to Java applications via the JNI. If you are looking for a general-purpose Linux environment, Android is not the answer.

CommonsWare
Thanks for the reply. That pretty much rules this option out, I'll keep on looking for alternatives.I have to work on Android, so general-purpose Linux is not an option, neither is rooting or reflashing the firmware. At least not at this point.
J Andy