No results for ""
EXPAND ALL
  • Home
  • API docs

Mobile targeting

Read time: 2 minutes
Last edited: Jun 24, 2024

Overview

This topic explains how to control which mobile apps and devices receive a variation of a feature flag.

Target mobile apps and devices

If you are using a mobile SDK that supports environment attributes, you can target your mobile applications based on automatically collected details about your application, application version, and device. You can also target mobile applications based on whether the application version is supported or unsupported. To learn more about configuring your mobile SDKs to enable this targeting, read Automatic environment attributes.

Mobile environment attributes must be collected first

You can only create a "Mobile" targeting rule, and target mobile apps and devices based on automatically collected mobile environment attributes, if you have completed the following:

  • your feature flag has its Client-side SDK availability set to include "SDKs using Mobile key." To learn more, read Creating new flags.
  • you have already started to collect mobile environment attributes in the ld_application and ld_device context kinds. LaunchDarkly must receive these context kinds before it enables the option to create a mobile targeting rule.

If you are using other mobile SDKs, you can target your mobile applications using custom targeting rules. With custom targeting rules, you can target your mobile applications based on any attributes that you have manually added to your contexts.

To target mobile apps and devices:

  1. Click the + Add rule button, or + between existing rules, and select "Target mobile":
The "+ Add rule" menu, with "Target mobile" called out.
The "+ Add rule" menu, with "Target mobile" called out.
  1. (Optional) Enter a name for the rule.
  2. In the Attribute menu, select the application or device attribute that you want to target on. By default, mobile targeting rules include clauses for the application version support status and for device information.
  3. In the Operator menu, select the operator for your clause.
  4. In the Application ID or Values menu, enter the values to check against.
  5. (Optional) Click + to add additional clauses to your targeting rule, or click - to remove existing clauses from your targeting rule.
  6. In the Rollout field, select the variation to serve, or set a percentage rollout.

Here is an example of a targeting rule for mobile apps:

A targeting rule for mobile apps.
A targeting rule for mobile apps.

To reference this rule when working with other members of your organization, click the link icon to copy a link to this rule.