Automatic environment attributes
Some SDKs automatically collect environment metadata and make it available as context attributes. This reduces boilerplate and provides consistent targeting capabilities.
ld_application
Automatically collected application metadata available in mobile and client-side SDKs.
Attributes
The ld_application context includes these attributes:
| Name | Description |
|---|---|
| key | Automatically generated by the SDK |
| id | Bundle Identifier |
| locale | Locale of the device, in IETF BCP 47 Language Tag format |
| name | Human-friendly name of the application |
| version | Version of the application used for update comparison |
| versionName | Human-friendly name of the version |
Use cases
Disable features on known bad builds
Target specific application versions to disable features on buggy releases:
IF ld_application version is one of 1.2.3, 1.2.4
THEN serve "Off"
This is valuable for mobile applications or heavily cached SPAs. Users may not update immediately.
Application-level configuration and customization
Serve different configurations based on application bundle ID or locale:
IF ld_application locale is one of es, es-MX, es-ES
THEN serve spanish-config
Determine when to sunset legacy behavior
Export context metrics to understand what application versions are still in use:
IF ld_application version < 2.0.0
THEN serve legacy-behavior
ELSE serve new-behavior
Use LaunchDarkly’s Data Export to analyze version distribution. This helps you decide when to drop support for older versions.
ld_device
Information about the platform, operating system, and device automatically collected by mobile SDKs.
Attributes
The ld_device context includes these attributes:
| Name | Description |
|---|---|
| key | Automatically generated by the SDK |
| manufacturer | Manufacturer of the device (Apple, Samsung, etc.) |
| model | Model of the device (iPhone, iPad, Galaxy S21) |
| /os | Operating system of the device. Includes properties for family, name, and version |
Use cases
Roll out by platform to reduce platform-specific issues
Start rollouts on platforms where you have stronger test coverage:
Rollout 10% by ld_device key
IF ld_device /os/family is iOS
Release to tier 1 supported platforms before testing on lower tiers
Prioritize your primary platforms:
IF ld_device manufacturer is one of Apple, Samsung
THEN serve 20% rollout
ELSE serve 5% rollout
Platform-specific feature or hardware targeting
Target features that require specific hardware capabilities:
IF ld_device model is one of iPhone 14, iPhone 15
AND custom-attribute has-nfc is true
THEN serve nfc-payment-feature
Operating system targeting
Access nested OS information using JSON paths:
IF ld_device /os/name is Android
AND ld_device /os/version >= 13
THEN serve android-13-features
To learn more, read the LaunchDarkly documentation on automatic environment attributes.