How to check if a build is made by the project launcher Android

I’ll add the code snippet! Maybe I am missunderstanding. But we are changing the folder location depending on what version of the app it is but only if it’s a project launcher build. But in InitCommandLine() in LaunchAndroid.cpp, they set what filepath the CommandLine is at. But we need to Append “/UE4Game/” with our appversion (if it’s a projectlauncher build). So it’s in this part of the logic we need to know if it’s a project launcher build, and the commandline itself will be in different locations depending on if it’s a projectlauncher build.

When it comes to accessing the CommandLine while the build is being deployed. In AndroidPlatform.Automation.cs we can access the commandLine and through that check if it’s a projectLauncher build :smiling_face_with_sunglasses:

I hope this makes sense :sweat_smile: thank you for your patience

`static void InitCommandLine()
{
static const uint32 CMD_LINE_MAX = 16384u;

// initialize the command line to an empty string
FCommandLine::Set(TEXT(“”));

AAssetManager* AssetMgr = AndroidThunkCpp_GetAssetManager();
AAsset* asset = AAssetManager_open(AssetMgr, TCHAR_TO_UTF8(TEXT(“UE4CommandLine.txt”)), AASSET_MODE_BUFFER);
if (nullptr != asset)
{
const void* FileContents = AAsset_getBuffer(asset);
int32 FileLength = AAsset_getLength(asset);

char CommandLine[CMD_LINE_MAX];
FileLength = (FileLength < CMD_LINE_MAX - 1) ? FileLength : CMD_LINE_MAX - 1;
memcpy(CommandLine, FileContents, FileLength);
CommandLine[FileLength] = ‘\0’;

AAsset_close(asset);

// chop off trailing spaces
while (*CommandLine && isspace(CommandLine[strlen(CommandLine) - 1]))
{
CommandLine[strlen(CommandLine) - 1] = 0;
}

FCommandLine::Append(UTF8_TO_TCHAR(CommandLine));
FPlatformMisc::LowLevelOutputDebugStringf(TEXT(“APK Commandline: %s”), FCommandLine::Get());
}

// read in the command line text file from the sdcard if it exists

////////////////// We need to append /UE4Game/ with the app name depending on what version it is
FString CommandLineFilePath = GFilePathBase + FString(“/UE4Game/”) + (!FApp::IsProjectNameEmpty() ? FApp::GetProjectName() : FPlatformProcess::ExecutableName()) + FString(“/UE4CommandLine.txt”);
//////////////////////////////////////////////////////////////////////////////////////////////`

I’ll add the code snippet! Maybe I am missunderstanding. But we are changing the folder location depending on what version of the app it is but only if it’s a project launcher build. But in InitCommandLine() in LaunchAndroid.cpp, they set what filepath the CommandLine is at. But we need to Append “/UE4Game/” with our appversion (if it’s a projectlauncher build). So it’s in this part of the logic we need to know if it’s a project launcher build, and the commandline itself will be in different locations depending on if it’s a projectlauncher build.

When it comes to accessing the CommandLine while the build is being deployed. In AndroidPlatform.Automation.cs we can access the commandLine and through that check if it’s a projectLauncher build :smiling_face_with_sunglasses:

I hope this makes sense :sweat_smile: thank you for your patience

`static void InitCommandLine()
{
static const uint32 CMD_LINE_MAX = 16384u;

// initialize the command line to an empty string
FCommandLine::Set(TEXT(“”));

AAssetManager* AssetMgr = AndroidThunkCpp_GetAssetManager();
AAsset* asset = AAssetManager_open(AssetMgr, TCHAR_TO_UTF8(TEXT(“UE4CommandLine.txt”)), AASSET_MODE_BUFFER);
if (nullptr != asset)
{
const void* FileContents = AAsset_getBuffer(asset);
int32 FileLength = AAsset_getLength(asset);

char CommandLine[CMD_LINE_MAX];
FileLength = (FileLength < CMD_LINE_MAX - 1) ? FileLength : CMD_LINE_MAX - 1;
memcpy(CommandLine, FileContents, FileLength);
CommandLine[FileLength] = ‘\0’;

AAsset_close(asset);

// chop off trailing spaces
while (*CommandLine && isspace(CommandLine[strlen(CommandLine) - 1]))
{
CommandLine[strlen(CommandLine) - 1] = 0;
}

FCommandLine::Append(UTF8_TO_TCHAR(CommandLine));
FPlatformMisc::LowLevelOutputDebugStringf(TEXT(“APK Commandline: %s”), FCommandLine::Get());
}

// read in the command line text file from the sdcard if it exists

////////////////// We need to append /UE4Game/ with the app name depending on what version it is
FString CommandLineFilePath = GFilePathBase + FString(“/UE4Game/”) + (!FApp::IsProjectNameEmpty() ? FApp::GetProjectName() : FPlatformProcess::ExecutableName()) + FString(“/UE4CommandLine.txt”);
//////////////////////////////////////////////////////////////////////////////////////////////`

Hi Aron,

If UE4CommandLine.txt is opened via AAssetManager_open, this is indicative that the data has been packaged in the APK, whereal if it is loaded from external storage, this is indicative of a free file deploy from editor with the “package assets in APK” disabled. You can use this as a differentiator of builds if it suits your needs.

Best regards.

Hi Aron,

If UE4CommandLine.txt is opened via AAssetManager_open, this is indicative that the data has been packaged in the APK, whereal if it is loaded from external storage, this is indicative of a free file deploy from editor with the “package assets in APK” disabled. You can use this as a differentiator of builds if it suits your needs.

Best regards.

I’ll add the code snippet! Maybe I am missunderstanding. But we are changing the folder location depending on what version of the app it is but only if it’s a project launcher build. But in InitCommandLine() in LaunchAndroid.cpp, they set what filepath the CommandLine is at. But we need to Append “/UE4Game/” with our appversion (if it’s a projectlauncher build). So it’s in this part of the logic we need to know if it’s a project launcher build, and the commandline itself will be in different locations depending on if it’s a projectlauncher build.

When it comes to accessing the CommandLine while the build is being deployed. In AndroidPlatform.Automation.cs we can access the commandLine and through that check if it’s a projectLauncher build :smiling_face_with_sunglasses:

I hope this makes sense :sweat_smile: thank you for your patience

`static void InitCommandLine()
{
static const uint32 CMD_LINE_MAX = 16384u;

// initialize the command line to an empty string
FCommandLine::Set(TEXT(“”));

AAssetManager* AssetMgr = AndroidThunkCpp_GetAssetManager();
AAsset* asset = AAssetManager_open(AssetMgr, TCHAR_TO_UTF8(TEXT(“UE4CommandLine.txt”)), AASSET_MODE_BUFFER);
if (nullptr != asset)
{
const void* FileContents = AAsset_getBuffer(asset);
int32 FileLength = AAsset_getLength(asset);

char CommandLine[CMD_LINE_MAX];
FileLength = (FileLength < CMD_LINE_MAX - 1) ? FileLength : CMD_LINE_MAX - 1;
memcpy(CommandLine, FileContents, FileLength);
CommandLine[FileLength] = ‘\0’;

AAsset_close(asset);

// chop off trailing spaces
while (*CommandLine && isspace(CommandLine[strlen(CommandLine) - 1]))
{
CommandLine[strlen(CommandLine) - 1] = 0;
}

FCommandLine::Append(UTF8_TO_TCHAR(CommandLine));
FPlatformMisc::LowLevelOutputDebugStringf(TEXT(“APK Commandline: %s”), FCommandLine::Get());
}

// read in the command line text file from the sdcard if it exists

////////////////// We need to append /UE4Game/ with the app name depending on what version it is
FString CommandLineFilePath = GFilePathBase + FString(“/UE4Game/”) + (!FApp::IsProjectNameEmpty() ? FApp::GetProjectName() : FPlatformProcess::ExecutableName()) + FString(“/UE4CommandLine.txt”);
//////////////////////////////////////////////////////////////////////////////////////////////`

Hi Aron,

If UE4CommandLine.txt is opened via AAssetManager_open, this is indicative that the data has been packaged in the APK, whereal if it is loaded from external storage, this is indicative of a free file deploy from editor with the “package assets in APK” disabled. You can use this as a differentiator of builds if it suits your needs.

Best regards.

I’ll add the code snippet! Maybe I am missunderstanding. But we are changing the folder location depending on what version of the app it is but only if it’s a project launcher build. But in InitCommandLine() in LaunchAndroid.cpp, they set what filepath the CommandLine is at. But we need to Append “/UE4Game/” with our appversion (if it’s a projectlauncher build). So it’s in this part of the logic we need to know if it’s a project launcher build, and the commandline itself will be in different locations depending on if it’s a projectlauncher build.

When it comes to accessing the CommandLine while the build is being deployed. In AndroidPlatform.Automation.cs we can access the commandLine and through that check if it’s a projectLauncher build :smiling_face_with_sunglasses:

I hope this makes sense :sweat_smile: thank you for your patience

`static void InitCommandLine()
{
static const uint32 CMD_LINE_MAX = 16384u;

// initialize the command line to an empty string
FCommandLine::Set(TEXT(“”));

AAssetManager* AssetMgr = AndroidThunkCpp_GetAssetManager();
AAsset* asset = AAssetManager_open(AssetMgr, TCHAR_TO_UTF8(TEXT(“UE4CommandLine.txt”)), AASSET_MODE_BUFFER);
if (nullptr != asset)
{
const void* FileContents = AAsset_getBuffer(asset);
int32 FileLength = AAsset_getLength(asset);

char CommandLine[CMD_LINE_MAX];
FileLength = (FileLength < CMD_LINE_MAX - 1) ? FileLength : CMD_LINE_MAX - 1;
memcpy(CommandLine, FileContents, FileLength);
CommandLine[FileLength] = ‘\0’;

AAsset_close(asset);

// chop off trailing spaces
while (*CommandLine && isspace(CommandLine[strlen(CommandLine) - 1]))
{
CommandLine[strlen(CommandLine) - 1] = 0;
}

FCommandLine::Append(UTF8_TO_TCHAR(CommandLine));
FPlatformMisc::LowLevelOutputDebugStringf(TEXT(“APK Commandline: %s”), FCommandLine::Get());
}

// read in the command line text file from the sdcard if it exists

////////////////// We need to append /UE4Game/ with the app name depending on what version it is
FString CommandLineFilePath = GFilePathBase + FString(“/UE4Game/”) + (!FApp::IsProjectNameEmpty() ? FApp::GetProjectName() : FPlatformProcess::ExecutableName()) + FString(“/UE4CommandLine.txt”);
//////////////////////////////////////////////////////////////////////////////////////////////`