-
Notifications
You must be signed in to change notification settings - Fork 127
Description
Before opening, please confirm:
- I have searched for duplicate or closed issues and discussions.
Language and Async Model
Java
Amplify Categories
Authentication
Gradle script dependencies
def aws_amplify_version = '2.29.2'
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
implementation "com.amplifyframework:aws-auth-cognito:$aws_amplify_version"
implementation "com.amplifyframework:core:$aws_amplify_version"
Environment information
Welcome to Gradle 8.14.2!
Here are the highlights of this release:
- Java 24 support
- GraalVM Native Image toolchain selection
- Enhancements to test reporting
- Build Authoring improvements
For more details see https://docs.gradle.org/8.14.2/release-notes.html
------------------------------------------------------------
Gradle 8.14.2
------------------------------------------------------------
Build time: 2025-06-05 13:32:01 UTC
Revision: 30db2a3bdfffa9f8b40e798095675f9dab990a9a
Kotlin: 2.0.21
Groovy: 3.0.24
Ant: Apache Ant(TM) version 1.10.15 compiled on August 25 2024
Launcher JVM: 17.0.12 (Oracle Corporation 17.0.12+8-LTS-286)
Daemon JVM: E:\Programare\jdk-17.0.12 (no JDK specified, using current Java home)
OS: Windows 11 10.0 amd64
Please include any relevant guides or documentation you're referencing
https://docs.amplify.aws/android/build-a-backend/auth/connect-your-frontend/sign-in/
Describe the feature request
I am using AWS Mobile SDK and Cognito in an Android app.
The old AWS Mobile SDK which was de-supported offered a way to verify if there ia a signed in user: AWSMobileClient.getInstance().isSignedIn()
It also offered a method to get the signed in user: AuthenticationProvider.getLoggedInUsername()
The Amplify SDK for Android does not offer any method like the above that checks only the local user state.
I could, for example use Auth.getCurrentUser(), Auth.fetchAuthSession() or Auth.fetchUserAttributes() but all of these are going over the network.
There are usecases where it is important to check the local user state fast, for example if you wanted to display an entry in the app menu.
Consider the case of a new user that just downloaded an android app and opens the app for the first time.
The user never performed a sign in yet, and the user is on a slow network.
All methods offered by Amplify for checking if the user is signed in will go over the wire, because there is no local user state.
On a slow GSM connection, that could take several seconds.
Blocking the UI, waiting for the call to return would make for a bad user experience.
Can you offer a variant of that just checks the local state only?
Initialization steps (if applicable)
No response
Code Snippet
Optional<AuthUser> optionalUser = Auth.getCurrentUser();
or
boolean loggedIn = Auth.isSignedIn();
Configuration File
No response
GraphQL Schema
// Put your schema below this line
Additional information and screenshots
No response