23 if (JNIEnv* Env = FAndroidApplication::GetJavaEnv())
25 IsApplicationInstalledFunction = FJavaWrapper::FindMethod(Env, FJavaWrapper::GameActivityClassID,
"AndroidThunkJava_IsPackageInstalled",
"(Ljava/lang/String;)Z",
false);
26 LaunchApplicationFunction = FJavaWrapper::FindMethod(Env, FJavaWrapper::GameActivityClassID,
"AndroidThunkJava_Launch",
"(Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;)Z",
false);
27 OpenURLFunction = FJavaWrapper::FindMethod(Env, FJavaWrapper::GameActivityClassID,
"AndroidThunkJava_OpenURL",
"(Ljava/lang/String;)V",
false);
28 GetIntentDataFunction = FJavaWrapper::FindMethod(Env, FJavaWrapper::GameActivityClassID,
"AndroidThunkJava_GetIntentData",
"()Ljava/lang/String;",
false);
29 GetApplicationExtraFunction = FJavaWrapper::FindMethod(Env, FJavaWrapper::GameActivityClassID,
"AndroidThunkJava_GetApplicationExtra",
"(Ljava/lang/String;)Ljava/lang/String;",
false);
30 GetDeviceSerialNumberFunction = FJavaWrapper::FindMethod(Env, FJavaWrapper::GameActivityClassID,
"AndroidThunkJava_GetDeviceSerialNumber",
"()Ljava/lang/String;",
false);
31 GetDeviceMacAddressFunction = FJavaWrapper::FindMethod(Env, FJavaWrapper::GameActivityClassID,
"AndroidThunkJava_GetMacAddress",
"()Ljava/lang/String;",
false);
40 if (JNIEnv* Env = FAndroidApplication::GetJavaEnv())
42 auto PackageNameArg = FJavaHelper::ToJavaString(Env, ApplicationName);
43 bResult = FJavaWrapper::CallBooleanMethod(Env, FJavaWrapper::GameActivityThis, FJavaWrapper::AndroidThunkJava_IsPackageInstalled, *PackageNameArg);
46 Log(
"UPixoLauncherSubsystem::IsApplicationInstalledFunction: %d", bResult);
55 if (JNIEnv* Env = FAndroidApplication::GetJavaEnv())
57 auto ApplicationNameArg = FJavaHelper::ToJavaString(Env, ApplicationName);
60 auto ExtraKeyArg = NewScopedJavaObject(Env, (jobjectArray)Env->NewObjectArray(ExtraKey.Num(), FJavaWrapper::JavaStringClass,
nullptr));
61 auto ExtraValueArg = NewScopedJavaObject(Env, (jobjectArray)Env->NewObjectArray(ExtraKey.Num(), FJavaWrapper::JavaStringClass,
nullptr));
62 for (uint32 Param = 0; Param < ExtraKey.Num(); Param++)
64 auto KeyStringValue = FJavaHelper::ToJavaString(Env, ExtraKey[Param]);
65 Env->SetObjectArrayElement(*ExtraKeyArg, Param, *KeyStringValue);
67 auto ValueStringValue = FJavaHelper::ToJavaString(Env, ExtraValue[Param]);
68 Env->SetObjectArrayElement(*ExtraValueArg, Param, *ValueStringValue);
70 bResult = FJavaWrapper::CallBooleanMethod(Env, FJavaWrapper::GameActivityThis, LaunchApplicationFunction, *ApplicationNameArg, *ExtraKeyArg, *ExtraValueArg);
73 Log(
"UPixoLauncherSubsystem::LaunchApplication: %s, %i : %i", *ApplicationName, ExtraKey.Num(), ExtraValue.Num());
93 FString ReturnedExtraValue = FString(
"");
95 if (JNIEnv* Env = FAndroidApplication::GetJavaEnv())
97 auto ExtraKeyArg = FJavaHelper::ToJavaString(Env, ExtraKey);
98 auto JavaKeyValue = (jstring)FJavaWrapper::CallObjectMethod(Env, FJavaWrapper::GameActivityThis, GetApplicationExtraFunction, *ExtraKeyArg);
99 ReturnedExtraValue = FJavaHelper::FStringFromLocalRef(Env, JavaKeyValue);
102 Log(
"UPixoLauncherSubsystem::GetApplicationExtra: %s", *ReturnedExtraValue);
104 return ReturnedExtraValue;
109 FString ReturnedExtraValue = FString(
"");
111 if (JNIEnv* Env = FAndroidApplication::GetJavaEnv())
113 auto JavaKeyValue = (jstring)FJavaWrapper::CallObjectMethod(Env, FJavaWrapper::GameActivityThis, GetIntentDataFunction);
114 ReturnedExtraValue = FJavaHelper::FStringFromLocalRef(Env, JavaKeyValue);
117 Log(
"UPixoLauncherSubsystem::GetIntentData: %s", *ReturnedExtraValue);
119 return ReturnedExtraValue;
124 FString ReturnedExtraValue = FString(
"");
126 if (JNIEnv* Env = FAndroidApplication::GetJavaEnv())
128 auto JavaKeyValue = (jstring)FJavaWrapper::CallObjectMethod(Env, FJavaWrapper::GameActivityThis, GetDeviceSerialNumberFunction);
129 ReturnedExtraValue = FJavaHelper::FStringFromLocalRef(Env, JavaKeyValue);
132 Log(
"UPixoLauncherSubsystem::GetDeviceSerialNumber: %s", *ReturnedExtraValue);
134 ReturnedExtraValue = TEXT(
"");
136 return ReturnedExtraValue;
141 FString ReturnedExtraValue = FString(
"");
143 if (JNIEnv* Env = FAndroidApplication::GetJavaEnv())
145 auto JavaKeyValue = (jstring)FJavaWrapper::CallObjectMethod(Env, FJavaWrapper::GameActivityThis, GetDeviceMacAddressFunction);
146 ReturnedExtraValue = FJavaHelper::FStringFromLocalRef(Env, JavaKeyValue);
149 Log(
"UPixoLauncherSubsystem::GetDeviceMacAddress: %s", *ReturnedExtraValue);
151 ReturnedExtraValue = FGenericPlatformMisc::GetMacAddressString();
153 return ReturnedExtraValue;
bool LaunchApplication(const FString &ApplicationName, const TArray< FString > &ExtraKey, const TArray< FString > &ExtraValue)
UFUNCTION(BlueprintCallable, Category = "PixoVR|Launcher")