Was this helpful?

With the API BaaS App Configuration feature, you can configure app-specific features in the admin portal. These settings are then passed to your app in the API BaaS configuration file, which you can then use to control the rollout of new features. Using the API BaaS App Configuration feature, you can create multiple configurations for your app and switch between them. The big advantage of this is that it allows you to roll back changes and test new configurations without pushing out new code.

Configuring app-specific features

To configure an app-specific feature, do the following:

  1. In the admin portal, make sure that the application shown in the Application drop-down menu on the page is your app.
  2. select 'Configure' in the main menu of the API BaaS admin portal.
  3. Select one of the following configuration types in the main menu, below 'Configure'.
    • Default Configs: Applies app-specific features to all devices running your app.
    • Beta Testing Configs: Applies app-specific features to specific devices, specified by device ID or phone number.
    • A/B Testing Configs: Applies app-specific features to a percentage of all devices running your app.
  4. For each feature you include in the configuration, specify the following in the 'Application Specific Configs' section at the bottom of the page:
    • category: Used to group configured features. The value of category can be anything you want. For example, you might name a category 'FEATURES' to group app-specific configurations that apply to new app features, such as photo/camera features.
    • key: Identifies a feature to be targeted by this configuration. For example, you might target 'enableCamera' which identifies whether the camera should be usable in this app-specific configuration.
    • value: Specifies how that feature should be handled in this configuration. For example, you might set the value to 'true' for the 'enableCamera' key to allow the user to use the device camera in your app.
  5. Click the + to add another feature configuration.

Example

For example, you might configure the new photo feature and a screen layout like this:

Category Key Value
FEATURES enableCamera true
LAYOUT dashboard alternate

Getting app-specific features

To access custom configuration parameters that are set in the API BaaS admin portal, obtain a reference to the AppMonitoringClient instance for your application. Then loop through the following collection available through the activeSettings property:

//App Delegate is instantiated with ApigeeClient when you initialize the SDK
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
for (ApigeeCustomConfigParam *param in appDelegate.monitoringClient.activeSettings.customConfigParams) {
	NSString *paramCategory = param.category;
	NSString *paramKey = param.key;
	NSString *paramValue = param.value;
}
		

You also need to write some code that enables Mobile Analytics to get the configuration for the features.

To enable an application-specific configuration for a parameter, add the following code. This allows Apigee to retrieve the parameter:

String value = AppMonConfig.getValue("<category>", "<key>");

Where category and key are the category and key value for the parameter.

App-specific feature configuration settings for your app are accessible in the deviceConfig object, and are updated any time you download the monitoring configuration file for you app. To access your custom configuration parameters, loop through deviceConfig.customConfigParameters:

//This example assumes your instance of Apigee.Client is called 'client'		
var configParams = client.monitor.deviceConfig.customConfigParameters;
for(param in configParams){
	//Check to see if a specific feature configuration is present
	if(configParams[param]['tag'] == 'LAYOUT' && configParams[param]['paramKey'] == 'dashboard' && configParams[param]['paramValue'] == 'alternate'){
		//In this case, we load an alternate HTML template for our dashboard if the config is present
		$('#dashboard').load('dashboard_alternate.html);
		break;
	}	
}
		

 

コメントを追加

Provide your email address if you wish to be contacted offline about your comment.
We will not display your email address as part of your comment.

We'd love your feedback and perspective! Please be as specific as possible.
Type the characters you see in this picture. (verify using audio)

Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.