There are a few options available for producing code to enable access to the White Label Sample App API endpoint.

We access the API with a username and password that is different for each Build configuration, so we need to supply the app, when it is built in a particular configuration, with the correct username and password.

We do this via a Constants file in the PCL Library which makes it available to both front end projects, iOS, and Droid


Note this is an inherently insecure access method and should not be used for user login information. A login here is used solely as an app identifier, and the API is readonly, providing only publicly accessible information. Any access key / password used like this will always be hardbaked into the app code so can never be truly secure

We can do this with three different techniques

  • Using the File Exchange feature to swap code files before compilation
  • Using C# Compiler Definitions to exclude code from compilation
  • Using a general settings constants file

There are pros and cons to each technique

  • File Exchange
    • Easy to refactor
    • Harder to miss adding a new configuration item to all configurations
    • Can be used to swap and configure more than just C# code
    • Restricts the app to only compile code that is for that configuration
  • C# Compiler Definitions
    • Hard to refactor as code is greyed out and the Visual Studio editor does not recognise it
    • Easy to miss a configuration item when adding new configuration steps
    • Only applies to C# code, i.e. can't be used within layout.axml definitions or Storyboards
  • General Settings Constants File
    • More refactorable
    • All code is compiled, bloating the code base and potentially exposing information about other versions of the app

We recommend using the File Exchange feature as it makes it is easy to manage your code base.


You can use the File exchange feature to swap any type of file in any of your projects

Examples include:

  • Droid Resources
    • axml layout files
    • drawables
    • xml value files, colors, languages, styles
    • fonts
  • iOS Storyboards
    • Images
    • Fonts
    • Entitlements.plist
  • Library
    • Code files
    • Appsettings.json files

The possibilities are endless