Issue
I need to access the built-in property values that CloudBees Feature Management uses for feature flag targeting (such as app version, OS version, screen dimensions, language, and country) in my application code for logging, analytics, or custom business logic. I am unsure what built-in properties are available in CloudBees Feature Management and how to retrieve these values programmatically without setting them manually.
Resolution
Understanding Built-in Properties
CloudBees Feature Management SDKs automatically collect several built-in properties that can be used for feature flag targeting and experimentation. These properties are automatically set by the SDK and include device, platform, and user context information.
You do not need to set built-in properties - they are automatically populated by the CloudBees Feature Management SDK. However, you can access the same values programmatically for your own application logic.
Common Built-in Properties
The following built-in properties are commonly available across CloudBees Feature Management SDKs:
-
rox.app_release- Application version -
rox.os_version- Operating system version -
rox.screen_width- Screen width in pixels -
rox.screen_height- Screen height in pixels -
rox.language- Device/browser language code -
rox.country- Device/browser country code -
rox.platform- Platform identifier (iOS, Android, web, etc.) -
rox.distinct_id- Unique user/device identifier -
rox.internal.lib_version- SDK library version -
rox.internal.appKey- Application key
| The availability of specific built-in properties may vary by platform and SDK version. Refer to the CloudBees Feature Management Properties documentation for platform-specific details. |
Accessing Built-in Property Values
While CloudBees Feature Management automatically collects these properties, you can access the same values in your application code for other purposes such as logging, analytics, or custom business logic.
iOS/Swift Example
The following example shows how to access the same values that CloudBees Feature Management uses for built-in properties on iOS:
import UIKit // App version (same as rox.app_release) if let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String { print("App version: \(appVersion)") } // OS version (same as rox.os_version) let osVersion = UIDevice.current.systemVersion print("OS version: \(osVersion)") // Screen dimensions (same as rox.screen_width/height) let screenSize = UIScreen.main.bounds.size let scale = UIScreen.main.scale let width = Int(screenSize.width * scale) let height = Int(screenSize.height * scale) print("Screen: \(width)x\(height)") // Language and country if let language = Locale.current.languageCode { print("Language: \(language)") // Same as rox.language } if let country = Locale.current.regionCode { print("Country: \(country)") // Same as rox.country }
Android/Kotlin Example
For Android applications, you can access similar information:
import android.content.Context import android.content.pm.PackageManager import android.os.Build import android.util.DisplayMetrics import java.util.Locale // App version (same as rox.app_release) val packageInfo = context.packageManager.getPackageInfo(context.packageName, 0) val appVersion = packageInfo.versionName println("App version: $appVersion") // OS version (same as rox.os_version) val osVersion = Build.VERSION.RELEASE println("OS version: $osVersion") // Screen dimensions (same as rox.screen_width/height) val displayMetrics = context.resources.displayMetrics val width = displayMetrics.widthPixels val height = displayMetrics.heightPixels println("Screen: ${width}x${height}") // Language and country val locale = Locale.getDefault() val language = locale.language // Same as rox.language val country = locale.country // Same as rox.country println("Language: $language") println("Country: $country")
JavaScript/Web Example
For web applications:
// App version (you would typically define this in your app) const appVersion = "1.0.0"; // Or from package.json console.log("App version:", appVersion); // Browser/OS information (same as rox.os_version) const userAgent = navigator.userAgent; console.log("User Agent:", userAgent); // Screen dimensions (same as rox.screen_width/height) const width = window.screen.width * window.devicePixelRatio; const height = window.screen.height * window.devicePixelRatio; console.log(`Screen: ${width}x${height}`); // Language (same as rox.language) const language = navigator.language.split('-')[0]; console.log("Language:", language); // Country (can be inferred from full locale) const fullLocale = navigator.language; const country = fullLocale.split('-')[1]; console.log("Country:", country);
Custom Properties
In addition to built-in properties, you can define custom properties to use for feature flag targeting. Custom properties allow you to segment users based on your own application-specific data.
For information about creating and using custom properties, refer to the CloudBees Feature Management Properties documentation.