Overview
Android Native is a plugin that makes it easy to call Java functions via JNI from Unreal Engine C++.
How to install
Select and download the release for the required engine version, extract the archive into your plugins project folder to get the following path: "[ProjectName] / Plugins / AndroidNative". Afterward, regenerate the project files and rebuild the project.
Basic internal description
The plugin uses JNI (Java Native Interface) to communicate C++ with Java.
Java method call example
Java (placed here)
@Keep
public class DeviceInfo {
@Keep
public static String GetUniqueID(Activity activity) {
return Settings.Secure.getString(activity.getContentResolver(), Settings.Secure.ANDROID_ID);
}
}
C++:
FString UniqueID = AndroidNativeUtils::CallJavaStaticMethod<FString>("com/Plugins/AndroidNative/DeviceInfo", "GetUniqueID", FAndroidGameActivity());