# User

You can obtain current TapTalk.io active user data by using these methods:

### Get TapTalk.io Active User

Obtain current TapTalk.io active user from cache by calling `getTaptalkActiveUser()`.

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

```java
import io.taptalk.TapTalk.Helper.TapTalk;
import io.taptalk.TapTalk.Model.TAPUserModel;

...

TAPUserModel activeUser = TapTalk.getTapTalkActiveUser();
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
import io.taptalk.TapTalk.Helper.TapTalk
import io.taptalk.TapTalk.Model.TAPUserModel

...

val activeUser = TapTalk.getTapTalkActiveUser()
```

{% endtab %}
{% endtabs %}

### Refresh TapTalk.io Active User

You can retrieve the latest TapTalk.io active user data from the server with the `refreshActiveUser()` method.

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

```java
import io.taptalk.TapTalk.Helper.TapTalk;
import io.taptalk.TapTalk.Listener.TapCommonListener;

...

TapTalk.refreshActiveUser(new TapCommonListener() {
    @Override
    public void onSuccess(String successMessage) {
        // Successfully updated active user data
        TAPUserModel activeUser = TapTalk.getTapTalkActiveUser();
    }

    @Override
    public void onError(String errorCode, String errorMessage) {
    
    }
});
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
import io.taptalk.TapTalk.Helper.TapTalk;
import io.taptalk.TapTalk.Listener.TapCommonListener;

...

TapTalk.refreshActiveUser(object : TapCommonListener() {
    override fun onSuccess(successMessage: String?) {
        // Successfully updated active user data
        val activeUser = TapTalk.getTapTalkActiveUser()
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})
```

{% endtab %}
{% endtabs %}

### Update Active User Bio

You are able to update the active user's bio with a custom string by calling `updateActiveUserBio()` from **TapCoreContactManager** class.

Successful update will be reflected in the **bio** field of the updated active user's data (`TAPUserModel.getBio()`).

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

```java
import io.taptalk.TapTalk.Manager.TapCoreContactManager;
import io.taptalk.TapTalk.Listener.TapCoreGetContactListener;
import io.taptalk.TapTalk.Model.TAPUserModel;

...

TapCoreContactManager.getInstance().updateActiveUserBio(BIO_STRING, new TapCoreGetContactListener() {
    @Override
    public void onSuccess(TAPUserModel user) {
        // Successfully updated active user bio
    }

    @Override
    public void onError(String errorCode, String errorMessage) {
    
    }
});
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
import io.taptalk.TapTalk.Manager.TapCoreContactManager
import io.taptalk.TapTalk.Listener.TapCoreGetContactListener
import io.taptalk.TapTalk.Model.TAPUserModel

...

TapCoreContactManager.getInstance().updateActiveUserBio(BIO_STRING, object : TapCoreGetContactListener() {
    override fun onSuccess(user: TAPUserModel?) {
        // Successfully loaded latest user data 
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
BIO\_STRING: (String) custom string for active user bio
{% endhint %}


---

# 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.taptalk.io/powertalk-chat-sdk-documentation/powertalk-android/user.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.
