Re: Access JNI methods from C++ Binder service

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Access JNI methods from C++ Binder service

Glenn Kasten
An example of what I think you're trying to do is AudioFlinger service within the native mediaserver process.
It accesses other services via binder, and those other services are implemented in Java programming language.
Note that AudioFlinger does not directly call JNI since it mediaserver is a native process, not a Dalvik process.
See the code in frameworks/{base,av}/services/audioflinger to see how it does this,
you'll also need to read the code in the other libraries that it links to.

On Tuesday, November 27, 2012 3:16:18 AM UTC-8, Arun wrote:
Hi,

I have a requirement to access a Java service from a native process.
The entry point is the native process started by init.rc and there is no UI, since I dont have any JVM reference I cannot initiate any communication to the java service from this process.
The way I am planning to do is, I have created a c++ binder service and my native process sends requests to this service, and through this Binder service I would like to access java class directly or through JNI.
Please let me know if it is possible.
This java service has a native interface, if my binder service is linked to that library can I call back java methods?
In summary can I access JNI or Java methods from a binder service without having JVM reference? 
please provide some example code if possible.
Thank you for your time.

br
Arun

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-platform/-/VGvQykagtcoJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.