传入受众群体属性

云眼About 1 min

传入受众群体属性

本主题介绍可以通过云眼灰度发布(特性标帜)AB实验 Android SDK 发送到云眼灰度发布(特性标帜)AB实验的可能用户属性值。

可以将字符串、数字、布尔值和 null 作为用户属性值传递。如果要根据访问群体使用的应用程序变体来定位访问群体,还可以传入格式为语义变体的open in new window字符串,然后在应用中定义访问群体条件。下面的示例演示如何传入属性。version

KotlinJava

val attributes: MutableMap<String, Any> = HashMap() attributes["device"] = "iPhone" attributes["lifetime"] = 24738388 attributes["is_logged_in"] = true attributes["application_version"] = "4.3.0-beta" val user = eyeofcloudClient.createUserContext("user123", attributes) val decision = user!!.decide("FLAG_KEY_HERE")

Map<String, Object> attributes = new HashMap<>(); attributes.put("device", "iPhone"); attributes.put("lifetime", 24738388); attributes.put("is_logged_in", true); attributes.put("application_version", "4.3.0-beta"); EyeofcloudUserContext user = eyeofcloudClient.createUserContext("user123", attributes); EyeofcloudDecision decision = user.decide("FLAG_KEY_HERE");

🚧 重要

请注意,在受众群体评估期间,如果没有为给定的受众群体条件传递有效的属性值(例如,如果在受众群体条件需要布尔值时传递字符串,或者您只是忘记传递值),则会跳过该条件。发生这种情况时,SDK 日志将包含警告。

Last update:
Contributors: “zhangweixue”,zhangweixue