08-11-2020 03:28 AM
08-11-2020 08:33 AM
11-21-2022 09:27 AM
I try using "Application Will Terminate Delegate" or "Application Will Enter Background Delegate" but neither seem to work. any other solution?
11-21-2022 04:03 PM
you need to enable the app to write on external storage (android permissions, i recommend doing this on begin play of the app),
10-10-2023 06:55 AM
Because ouclus sdk didnt implement Application Will Terminate Delegate with oculus you need to use native java method in unreal. That what I did.
1. Added JNI native method at GameInstance as
extern "C" JNIEXPORT void JNICALL Java_com_epicgames_ue4_GameActivity_OnAppTerminated(JNIEnv* jenv, jobject thiz)
{
UPVPGameInstance::NotifyServerLeaving(); // this is static method
UE_LOG(LogTemp, Error, TEXT("ApplicationWillTerminateDelegate"));
}
2. Added UPL XML with code and included it on build:
<?xml version="1.0" encoding="utf-8"?>
<root xmlns:android="http://schemas.android.com/apk/res/android">
<!-- optional additions to the GameActivity class in GameActivity.java -->
<gameActivityClassAdditions>
<insert>
<![CDATA[
private native void OnAppTerminated();
]]>
</insert>
</gameActivityClassAdditions>
<!-- -->
<gameActivityOnDestroyAdditions>
<insert>
<![CDATA[
OnAppTerminated();
]]>
</insert>
</gameActivityOnDestroyAdditions>
</root>
3. If you are developing multiplayer game and would like to notify server about that exit you need to send custom udp message on server (you can't do http because you need time for handshake and you have no time for it)