3

I've created a native binder service with a few transactions types.

At the moment i have native proxy ( Bp ) for clients, but i want to give Java clients the possibility to use my service.

Basically, the Bp should be Java i think. I've found some stuff about JNI, but incomplete. I need to use JNI inside Bn?

Also, a callback mechanism ( sporadic event from service to a specific client method ) should be available. I've done it in native.

Onik
  • 19,396
  • 14
  • 68
  • 91
Cumatru
  • 695
  • 2
  • 12
  • 34
  • I've managed to perform a simple call using the example from here https://github.com/cloudchou/NativeBinderJavaClientDemo/blob/master/FClient/src/com/cloud/test/CloudManagerProxy.java Callbacks from native to JNI and transfering of complex data structures remain as an issue. – Cumatru May 08 '16 at 18:02

1 Answers1

0

Here goes my first answer ever...

As mentioned by Cumatru I also used https://github.com/cloudchou/NativeBinderJavaClientDemo.

I have not yet fully understood the whole process, but at least it works and it's a way to move forward with a pretty "simple" example. I am on a very basic android level, so please bear with me and help improve the answer in whatever way you'd like.

There seem to be three parts: 1. A server process made in c++ running natively. 2. An android application client. 3. A simple java-client that will be built into a .jar-file.

No alteration to the code seems to be necessary, at least for the simple java-client and the c++-server.

  • Build and push the server-application to your target. Run it in an adb shell.
  • Build and push the java-client (.jar-file), called fclient, to your target in /system/framework/
  • Run the java-client using the fclient-script
  • An addition will be made on the two integers sent from the client, and replied back to the server.

Hopefully it works for you too.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
magnussn
  • 19
  • 5