हिन्दी में पढ़ने के लिए यहाँ क्लिक करें
Basic Android Native Library Examples for Beginners (JNI via C++ Libraries)
-
- This uses native-lib.cpp to get string from our C++ library and print that on screen using regular TextView.setText(String) function.
-
Basic Calculator (Native Library)
- This uses native library to do simple calculations and then display the result.
- JNI functions take parameters in jstring (Java String) then converts it into C string (char*) and then into C integer (int) via std::atoi()
- Flow : String -> Jstring -> Char* -> int -> std::string -> c_string() -> String
-
Native Obfuscation (Sample C++ based Java Obfuscation)
- This uses native library to Obfuscate the code.
- JNI functions takes two parameters in jstring (Java String) and jint (Java Integer) and then performs XOR with (jint/10042069)
- Uses
Class.forName().getMethod()
andMethod.invoke()
to obfuscate class names and basic method calls.