#✅ - Component Authenticator in Android - JAVA

3 messages · Page 1 of 1 (latest)

fresh pivot
#

Good afternoon,

We want to ask you a question, we currently have an Android application written in JAVA, it is quite old and we are evaluating the incorporation of amazon cognito.

We have seen that Amazon cognito has an Authenticator component (https://ui.docs.amplify.aws/android/connected-components/authenticator), but we see that only the Kotlin implementation is reported.

We would like to know if it is possible to use this component in our application since we did not find information on how to implement it in an android application written in JAVA.

We have managed to implement it in React and now we want to implement it in the mobile part

All the best

alpine marsh
#

Hey @fresh pivot, thanks for reaching out. The Authenticator component for Android is built using Jetpack Compose, which is a Kotlin-only UI toolkit. Although you cannot directly use Compose with Java, you could still incorporate Authenticator into your Java application with a some extra effort. Compose includes APIs for interoperability with the View system, in particular AbstractComposeView (https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AbstractComposeView), which can be used to embed Compose content inside a View hierarchy.

You could write a custom subclass of AbstractComposeView that hosts an instance of the Authenticator component. This subclass would need to be implemented in Kotlin, but all code that interacts with it could be written in Java. Here are some articles that have examples using AbstractComposeView:

Please note as well that you need to be using Amplify version 2.7.1 or greater to use Authenticator. Hope this helps and good luck!

Medium

In Part 1 I demonstrated how we can use AndroidView to render traditional Views inside our Compose UI. For this part, we are now going to…

Medium

Beyond normal Jetpack Compose Development, e.g. building Tooltip, Coachmark, Custom Toast, etc.

turbid mauveBOT
#

✅ - Component Authenticator in Android - JAVA