Create Android Service in C/C++

48 views
Skip to first unread message

mac actiaitalia

unread,
Aug 4, 2020, 10:48:57 AM8/4/20
to android-ndk
Hello Everyone,

I know it is possible create an Activity in C/C++, but is it possible create a service in C/C++? If yes, is there a tutorial to do it?

Regards

Alex Cohn

unread,
Aug 10, 2020, 1:06:56 PM8/10/20
to android-ndk
Hi

NativeActivity is a special Java class that is part of the platform. It delegates all callbacks to C++ and so you can build an Android app writing literally 0 lines of code in Java. Still, your app will running in JVM. In many cases, the NativeActivity does not answer all the needs, and the developers choose to extend this class in Java, just like they extend the regular Activity class.

The similar work for Service class has never been done, so if you want to code a Service in C++, you must first produce a Java harness similar to NativeActivity. Luckily, the source code is available.

Hope this helps,
Alex Cohn

Reply all
Reply to author
Forward
0 new messages