If the user is signed in through [Amplify.Auth.signIn](/lib/auth/signin), then you can retrieve the current user's ID as shown below:

<BlockSwitcher>
<Block name="Java">

```java
Amplify.Auth.getCurrentUser(
    authUser -> String userId = authUser.getUserId(),
    error -> Log.e("MyAmplifyApp", "Error getting current user", error)
);
```

</Block>
<Block name="Kotlin - Callbacks">

```kotlin
Amplify.Auth.getCurrentUser(
    { authUser -> val userId = authUser.userId }, 
    { Log.e("MyAmplifyApp", "Error getting current user", it) }
)
```

</Block>
<Block name="Kotlin - Coroutines">

```kotlin
try {
    val userId = Amplify.Auth.getCurrentUser().userId
} catch (error: PushNotificationsException) {
    Log.e("MyAmplifyApp", "Error getting current user", error)
}
```

</Block>
<Block name="RxJava">

```java
RxAmplify.Auth.getCurrentUser().subscribe(
    authUser -> String userId = authUser.getUserId(),
    error -> Log.e("MyAmplifyApp", "Error getting current user", error)
);
```

</Block>
</BlockSwitcher>