# registerActiveEntitlementsHandler

Register a callback to react to a potential changes to the active entitlements for the user, whenever such state is fetched from the Nami service. This occurs during the course of the application lifecycle as well as when [refresh](/sdk-reference/namientitlementmanager/refresh.md) is called.

{% tabs %}
{% tab title="Swift" %}

```swift
NamiEntitlementManager.registerActiveEntitlementsHandler { (activeEntitlements: [NamiEntitlement]) in
  // respond to the current active entitlements for the user
}
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
NamiEntitlementManager.registerActiveEntitlementsHandler { activeEntitlements ->
  // respond to the current active entitlements for the user
}
```

{% endtab %}

{% tab title="Flutter" %}

```dart
NamiEntitlementManager.registerActiveEntitlementsHandler()
    .listen((activeEntitlementHandlerData) {
});
```

{% endtab %}

{% tab title="React Native" %}

```jsx
import {NamiEntitlementManager, NamiEntitlement} from 'react-native-nami-sdk';

const subscriptionRemover =
  NamiEntitlementManager.registerActiveEntitlementsHandler(
    (activeEntitlements) => {
      console.log('activeEntitlements', activeEntitlements);
      setEntitlements(activeEntitlements);
    },
  );
return () => {
  subscriptionRemover();
};
```

{% endtab %}

{% tab title="Unity" %}

```c
NamiEntitlementManager.RegisterActiveEntitlementsHandler(activeEntitlementsCallback);
```

{% endtab %}
{% endtabs %}

**Returns**

* `activeEntitlements` - a list of the current entitlements active for the user and device.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.namiml.com/sdk-reference/namientitlementmanager/registeractiveentitlementshandler.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
