Device Variables

You might have API keys and other secrets that your app needs to consume — either at run time or during a build. However, you might not want to check these secrets into your source code to make them available to your app.

In order to securely propagate your credentials to your build and app, buddybuild provides two sets of variables that you can define:

  1. Environment Variables (made available to your build time scripts)

  2. Device Variables (available your App at run time via the buddybuild SDK)

  3. Secure Files (files made available to your build time scripts)

Let’s get started with Device Variables!

Step 1: Create Device Variables in buddybuild

Launch the buddybuild dashboard and click on App Settings.

Builds   Settings.png

In the left navigation, select Build settings, then Device Variables.

Settings   Device variables   menu.png

Enter a name, value and select Create.

Settings   Device variables.png

Buddybuild will securely embed your variable into the app when it is built next. Your variable will be consumable via the buddybuild SDK.

Step 2: Consuming the variable

To consume the variable in your build, substitute the name of your device variable where applicable (see example below).

let accessToken = BuddyBuildSDK.valueForDeviceKey("Facebook_Token")
NSString* accessToken = [BuddyBuildSDK valueForDeviceKey:@"Facebook_Token"];

That’s it! For more details, refer to our SDK API guide.

If you want to consume your variables from within your build instead, follow the Environment Variables guide.

results matching ""

    No results matching ""