I have a question about the limitations of what you can do in native code on the Android platform.
Basically I have developed a library in native C code that uses UDP sockets for SIP/RTP and uses OpenAL for audio recording/playback - basically the whole application. The idea is to have as much as possible in native C code rather than Java code. I want to do this because I am going to use it on other platforms as well.
My question then is simply - is it possible to just use the Java for the GUI and then all processing in native code? What will happen when my native code tries to create a socket, bind it, record audio, play it, etc - since it is in native code, do I need to setup permissions for it (such as application accessing microphone and whatnot) or will it just bypass this stuff since its native code? Can native code do pretty much anything it wants on Android like on PCs?
Sorry if its unclear; just tell and I'll try to improve it
Thanks
You can do pretty much anything you want in native code, but the only OS-level thing really supported is OpenGL, OpenSL, and some number-crunching libraries (compression, math, etc).
However, at any time you're free to use the JNI to call a Java method, so you could use the standard Android API for networking (classes like Socket
, etc). Obviously, since the call is going through the Java API, all the normal Android permissions apply (like android.permission.INTERNET
).
EDIT: As elaborated in the comments, the standard libraries that are part of the NDK do have support for sockets.