Accessing hardware

Is it possible with UE4 to access hardware – such as the Camera, GPS, SMS, Telephony ?

bueller… bueller ?
maybe I will write a plugin for this.

These are not exposed at the moment but the proper permissions may be added to the AndroidManifest.xml in Android Project Settings, then you can add JNI code to access the Java features. Right now this would require adding your Java code to GameActivity.java in the engine and to the AndroidJNI.h / AndroidJNI.cpp files.

As an example, take a look at AndroidThunkJava_LaunchURL(String URL) in GameActivity.java. This takes a string passed in and launches the browser intent. There is a corresponding AndroidThunkCpp_LaunchURL(const FString& URL) in AndroidJNI.cpp which calls it.


static jmethodID AndroidThunkJava_LaunchURL;

is added to FJavaWrapper in AndroidJNI.h, and this declaration is in AndroidJNI.cpp:


jmethodID FJavaWrapper::AndroidThunkJava_LaunchURL;

this is set in FJavaWrapper::FindClassesAndMethods(JNIEnv* Env) in AndroidJNI.cpp:


AndroidThunkJava_LaunchURL = FindMethod(Env, GameActivityClassID, "AndroidThunkJava_LaunchURL", "(Ljava/lang/String;)V", bIsOptional);

thanks Chris… I know exactly what to do, now that I know where the entry point is.