Getting App Name Programmatically

In any other app type I can use App.ExecutableFile.Name but for Android this is missing at the moment. What is a way to get the Android App Name programmatically?

While I can’t help you with Android, on the macOS this may not return the name of the application that the customer sees, as it can be localized or just downright replaced in the Information Property List.

You’ll need declares to get the same name that a customer sees, Below is some code to get you started.

#if TargetMacOS then
  return replace( NSRunningApplication_localizedName( NSRunningApplication_currentApplication( NSClassFromString( "NSRunningApplication" ) ) ), _
  ".debug", "" )
#endif

Try using a constant for the name and then setting its name in the Android target to that. For instance, if you add a constant to App called kAppName you would use

  • App.kAppName in code
  • #App.kAppName in the Inspector
1 Like