![]() The provided attributes plan_type, registered_date, permissions, paying_customer, and deal_size are passed to the getTreatment call. In the example below, we are rolling out a feature flag to users. To target based on custom attributes, the SDK's getTreatment method needs to be passed an attribute map at runtime. Val treatments: Map = client.getTreatments(featureFlagNames, null) Val featureFlagNames: List = listOf("FEATURE_FLAG_NAME_1", "FEATURE_FLAG_NAME_2") Make sure to remember the final else branch in your code to handle the client returning control. From there, use an if-else-if block as shown below and plug the code in for the different treatments that you defined in the Split user interface. Once the SDK_READY event fires, use the getTreatment method to return the proper treatment based on the FEATURE_FLAG_NAME you pass and the key you passed when instantiating the SDK. We set the client to listen for the SDK_READY event triggered by the SDK before asking for an evaluation. To make sure the SDK is properly loaded before asking it for a treatment, wait until the SDK is ready as shown below. The following explains how to use this SDK. Val client: SplitClient = splitFactory.client() Using the SDK SplitFactoryBuilder.build(sdkKey, key, config, applicationContext) This could also be a cookie you generate for anonymous users key represents your internal user id, or the account id that Val config: SplitClientConfig = SplitClientConfig.builder().build() This is a special type of API token with limited privileges that is used for the untrustable browsers or mobile clients. The API key is available on your Admin Settings page, on the APIs keys tab. Include the API key for the environment that you are setting up the SDK for. We recommend instantiating the SDK once as a singleton and reusing it throughout your application. Further initializations fetch data from that cache and the configuration is immediately available. In this circumstance, the SDK does not fail, rather, it returns the control treatment.Īfter the first initialization, the fetched data is stored. If the SDK is asked to evaluate which treatment to show to a customer for a specific feature flag while it is in this intermediate state, it may not have the data necessary to run the evaluation. This process can take up to a few hundred milliseconds, depending on the size of the data. The first time the SDK is instantiated, it starts background tasks to update an in-memory cache and in-storage cache with small amounts of data fetched from Split servers. ![]() Instantiate the SDK and create a new Split client Implementation 'io.split.client:android-client:3.3.0' 2. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |