#androidstudio #androidDev #retrofit
Retrofit android tutorial User login from the database, Learn how to authenticate from database using a retrofit.
Adding the following dependencies.
Retrofit: type-safe HTTP client for Android and Java.
Gson: Convertor Library
OkHttp interceptor: Logs HTTP request and response data.
Create UserService were all the calls will be performed.
Create ApiClient Class which will serve as a retrofit instance.
Design a login screen with two edit text (username, password ) and a login button.
Listen when the login button is clicked, check if the user has keyed in username and password if yes perform login else toast an error message.
During login from backend, we shall check if provided credentials match what is stored in the database if yes we allow the user to login else we show login failed
Create a new activity where the user will be redirected on successful login when login response is successful, Redirect user, and pass the username to other activity.
Thanks for watching if you are not subscribed. Kindly subscribe for more tutorials.
More details and source code:
Find the server side api here.
For additional help, feel free to comment below.