-
I believe the default behavior is once you have signed in, it will continue to use that account. There are some different behaviors you can use detailed here https://developers.google.com/identi…ndroid/sign-in
-
Use a UPL per project, this is the section in my Android_UPL.xml file that does this:
<gameActivityOnCreateAdditions>
<insert>
// CUSTOM:
try
{
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN)
.requestProfile()
.requestServerAuthCode("xxxxxxxxxxxx.apps.googleusercontent.com")
.build();
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
}
catch (Exception e)
{
Log.debug("GoogleSignIn exception caught: " + e.toString());
}
Log.debug("mGoogleSignInClient is " + ((mGoogleSignInClient == null) ? "disabled" : "valid"));
</insert>
</gameActivityOnCreateAdditions>
then in the Build.cs
if(Target.Platform == UnrealTargetPlatform.Android)
{
DynamicallyLoadedModuleNames.Add("OnlineSubsystemGooglePlay");
var pluginPath = Utils.MakePathRelativeTo(ModuleDirectory, Target.RelativeEnginePath);
AdditionalPropertiesForReceipt.Add("AndroidPlugin", System.IO.Path.Combine(pluginPath, "Android_UPL.xml"));
}
You will still need to manually add the code to AndroidThunkJava_GoogleClientConnect() but the rest of the code can be done in a UPL file.
Edit:
I attached my UPL for this and X’d the PlayFab auth code, just rename it from txt to xml because I can’t upload XML files for some reason. Just place the UPL in the same folder as the build.cs for your project.