Search code examples
androidgoogle-app-engineauthenticationgae-userservice

How does UserService class work?


I am trying to implement a login system using the Android Studio LoginActivity template. On AppEngine, I try the two lines:

UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();

but the user is always null. How is it supposed to function and be implemented? I mean, does UserService class only work when integrating the Login with Google Accounts?

If yes, what is the best and smartest way for me to implement a customized login system?


Solution

  • Yes, UserService class only work when integrating the Login with Google Accounts (Gmail or Apps), and here is how you can handle that.

    About the customized login system, there isn't a correct answer, you need to implement a system of API (login, register, reset password, ...) based on your needs. Surely you need a datastore entity which preserves the account information and the password for the login process.