SDLActivity NDK communicating with C++. |
SDLActivity NDK communicating with C++. |
Michael Labbe
Guest
|
You can call into Java code using the JNI. The JNI requires a JNIEnv ptr and possibly an activity class or possibly an object. You can access these via SDL:
https://wiki.libsdl.org/SDL_AndroidGetJNIEnv Note that you are on the game thread and not your UI thread when running your native code. Depending on how your Ad SDK is set up, this may cause concurrency issues which you must address. The Android Readme explains the threading situation. You can get blocks of Java code to run on the ui thread by using runOnUiThread. It is a well documented thing across the web, used in more Android places than just SDL game development. Michael Labbe On Mon, Feb 1, 2016 at 4:47 PM, Timodor wrote:
|
|||||||||||||
|
... |
Timodor
|
Thanks for this information, I did get working using your information. With Help of Friend all we had to do was create a Java Function in SDLactivity.java and it worked. But Still having bugs with the threads.
|
|||||||||||
|