ndk calling sdk

82 views
Skip to first unread message

techxpl...@gmail.com

unread,
Mar 27, 2017, 12:00:25 PM3/27/17
to android-ndk
Hi,

Would it be possible to call Android SDK from NDK through JNI?
Tried to lookup but failed to find any information.

Any advice is appreciated.
Message has been deleted

Gerry Fan

unread,
Mar 27, 2017, 1:00:44 PM3/27/17
to android-ndk
Personally I do not know the direct way calling SDK API from NDK via JNI.  Sample creates Java side functions, which call SDK functions; from NDK function, sample call into the Java side function.  Teapot has the trick[JNIHelper, NDKHelper.java etc], hello-jniCallback just to show how to set up NDK --> Java SDK side communication [calling Java private functions from JNI is not recommended though]

voks

unread,
Mar 28, 2017, 9:57:25 AM3/28/17
to android-ndk
You can do this. Just need to use proper class/func/signature which sometimes not easy to know. Also you have to take care about return value, exceptions and threads of cause.
The solution in prev answer is much easier to do.

s.rawat

unread,
Mar 29, 2017, 12:04:38 PM3/29/17
to android-ndk
you can call into java from ndk(no idea if you can call directly from ndk to sdk APIs). So if it is acceptable to call into Java from ndk  , you can create a wrapper which in turn will call the SDK APIs from the java code.

On Tue, Mar 28, 2017 at 7:27 PM, voks <vok...@gmail.com> wrote:
You can do this. Just need to use proper class/func/signature which sometimes not easy to know. Also you have to take care about return value, exceptions and threads of cause.
The solution in prev answer is much easier to do.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+unsubscribe@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/adcf3efd-8b4e-414c-bf4f-de99f1643a7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages