UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
AndroidJNI.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6
7#if USE_ANDROID_JNI
8#include <jni.h>
9#include <android/log.h>
10
11extern JavaVM* GJavaVM;
12
14
16
17DECLARE_MULTICAST_DELEGATE_TwoParams(FOnRouteServiceIntent, const FString&, const FString&);
18
19// Define all the Java classes/methods that the game will need to access to
20class FJavaWrapper
21{
22public:
23
24 // Nonstatic methods
87
88
89 // Screen capture/recording permission
92
93 // Native view click filtering
95
96 // InputDeviceInfo member field ids
105
106 // IDs related to google play services
117
118 // Optionally added if GCM plugin (or other remote notification system) enabled
122
123 // In app purchase functionality
124 static jclass JavaStringClass;
132
133 // SurfaceView functionality for view scaling on some devices
138
139 // Screen refresh rate
143
144 // Motion controls
146
147 // Network Connection Listener
150
151 // member fields for getting the launch notification
155 static jfieldID LaunchNotificationFireDate;
156
157 // method and classes for thread name change
158 static jclass ThreadClass;
161
162 // WifiManager's Multicastlock handling
165
169 static void FindClassesAndMethods(JNIEnv* Env);
170
174 static jclass FindClass(JNIEnv* Env, const ANSICHAR* ClassName, bool bIsOptional);
175 static jclass FindClassGlobalRef(JNIEnv* Env, const ANSICHAR* ClassName, bool bIsOptional);
176 static jmethodID FindMethod(JNIEnv* Env, jclass Class, const ANSICHAR* MethodName, const ANSICHAR* MethodSignature, bool bIsOptional);
177 static jmethodID FindStaticMethod(JNIEnv* Env, jclass Class, const ANSICHAR* MethodName, const ANSICHAR* MethodSignature, bool bIsOptional);
178 static jfieldID FindField(JNIEnv* Env, jclass Class, const ANSICHAR* FieldName, const ANSICHAR* FieldType, bool bIsOptional);
179
180 static void CallVoidMethod(JNIEnv* Env, jobject Object, jmethodID Method, ...);
182 static int32 CallIntMethod(JNIEnv* Env, jobject Object, jmethodID Method, ...);
183 static int64 CallLongMethod(JNIEnv* Env, jobject Object, jmethodID Method, ...);
184 static float CallFloatMethod(JNIEnv* Env, jobject Object, jmethodID Method, ...);
185 static double CallDoubleMethod(JNIEnv* Env, jobject Object, jmethodID Method, ...);
186 static bool CallBooleanMethod(JNIEnv* Env, jobject Object, jmethodID Method, ...);
187
188 static void CallStaticVoidMethod(JNIEnv* Env, jclass Clazz, jmethodID Method, ...);
192 static float CallStaticFloatMethod(JNIEnv* Env, jclass Clazz, jmethodID Method, ...);
193 static double CallStaticDoubleMethod(JNIEnv* Env, jclass Clazz, jmethodID Method, ...);
194 static bool CallStaticBooleanMethod(JNIEnv* Env, jclass Clazz, jmethodID Method, ...);
195
196 // Delegate that can be registered to that is called when an activity is finished
198
199 // Delegate that can be registered to that is called when an SafetyNet Attestation is finished
201
202 // Delegate that can be registered to be called when a service intent is received
204
205private:
206
208 static void FindGooglePlayMethods(JNIEnv* Env);
211
212 // Setup communication with wrapper apps
214};
215#endif
JavaVM * GJavaVM
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::ANSICHAR ANSICHAR
An ANSI character. Normally a signed type.
Definition Platform.h:1131
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_MULTICAST_DELEGATE_TwoParams(DelegateName, Param1Type, Param2Type)
Definition DelegateCombinations.h:58
#define DECLARE_MULTICAST_DELEGATE_SixParams(DelegateName, Param1Type, Param2Type, Param3Type, Param4Type, Param5Type, Param6Type)
Definition DelegateCombinations.h:94
#define DECLARE_MULTICAST_DELEGATE_ThreeParams(DelegateName, Param1Type, Param2Type, Param3Type)
Definition DelegateCombinations.h:67
UStruct * FindClass(const FReadState &State)
Definition StructDeserializer.cpp:40