---
title: Update Android API usage from older versions
slug: feature-experimentation/docs/migrate-from-older-versions-android
docTags: 
createdAt: 2026-08-05T20:40:03.000Z
---

This section provides code examples for how You should leveraging the new [Decision](docId:0RRA0tqKb53_Evlvk1hNS) and [Event Tracking](docId\:kRTOAg7BcKHnsSYIOGsT8) APIs. All existing [Full Stack (Legacy)](docId:6_ik6SSz-WyJLWuCQw7BT) methods and implementation are still supported. See [Optimizely Feature Experimentation - application & migration](docId\:bykQnE4aGRkC5WXhU6Yi5) documentation for the latest updates.

You should adopting the new `Decide`, `Decide All`, and `Track Event` methods as a more flexible and easier-to-use replacement where you currently use `isFeatureEnabled`, `getFeatureVariable`, `getAllFeatures`, or `Track` calls within your implementation.

The following are examples of how to migrate the Full Stack (Legacy) methods to Feature Experimentation methods:

```kotlin
// Prereq for new methods: create a user
val attributes: MutableMap<String, Any?> = HashMap()
attributes["is_logged_in"] = true
val user = optimizelyClient.createUserContext("user123", attributes)

// Is Feature Enabled

// old method
var enabled = optimizelyClient.isFeatureEnabled("flag_1", "user123", attributes)
// new method
val decision = user!!.decide("flag_1")
enabled = decision.enabled

// Activate & Get Variation

// old method
val variation = optimizelyClient.activate("experiment_1", "user123", attributes)
// new method
val variationKey = decision.variationKey

// Get All Feature Variables

// old method
var json = optimizelyClient.getAllFeatureVariables("flag_1", "user123", attributes)
// new method
json = decision.variables

// Get Enabled Features

// old method
val enabledFlags = optimizelyClient.getEnabledFeatures("user123", attributes)
// new method
val options = Arrays.asList(OptimizelyDecideOption.ENABLED_FLAGS_ONLY)
val decisions = user.decideAll(options)
val enabledFlagsSet: Set<String> = decisions.keys

// Track

// old method
val tags: MutableMap<String, Any?> = HashMap()
tags["purchase_count"] = 2
optimizelyClient.track("my_purchase_event_key", "user123", attributes, tags)
// new method
user.trackEvent("my_purchase_event_key", tags)
```

```java
// Prereq for new methods: create a user
Map<String, Object> attributes = new HashMap<>();
attributes.put("is_logged_in", true);
OptimizelyUserContext user = optimizelyClient.createUserContext("user123", attributes);
        
// Is Feature Enabled
        
// old method
boolean enabled = optimizelyClient.isFeatureEnabled("flag_1", "user123", attributes);
// new method
OptimizelyDecision decision = user.decide("flag_1");
enabled = decision.getEnabled();
        
// Activate & Get Variation
        
// old method
Variation variation = optimizelyClient.activate("experiment_1", "user123", attributes);
// new method
String variationKey = decision.getVariationKey();
        
// Get All Feature Variables

// old method
OptimizelyJSON json = optimizelyClient.getAllFeatureVariables("flag_1", "user123", attributes);
// new method
json = decision.getVariables();
        
// Get Enabled Features

// old method
List<String> enabledFlags = optimizelyClient.getEnabledFeatures("user123", attributes);
// new method
List<OptimizelyDecideOption> options = Arrays.asList(OptimizelyDecideOption.ENABLED_FLAGS_ONLY);
Map<String, OptimizelyDecision> decisions = user.decideAll(options);
Set<String> enabledFlagsSet = decisions.keySet();
        
// Track

// old method
Map<String, Object> tags = new HashMap<>();
tags.put("purchase_count", 2);
optimizelyClient.track("my_purchase_event_key", "user123", attributes, tags);
// new method
user.trackEvent("my_purchase_event_key", tags);
```
