2. Login ScreenΒΆ
After the splash screen generally comes a login screen that allows the user to identify himself/herself. This is an important step because this identity of the user is what is used throughout the game for giving rewards, storing profile of the user that may include the resources owned by the user and in general to maintain the state/progression of the user within the game - so that he/she can continue to play from the last position onwards and not start from the beginning.
Playblazer supports two types of logins:
- social login (FB/Google+)
- guest login (using the device’s UNIQUE id).
You need to call the “Login” API from “User Profile” module. If the profile is not available on the server, the API will return with an error ‘E_NO_PROFILE’. In that case, you need to call the “Create Profile” API - followed by “Login” API again.
You can add any custom attributes to be stored in the profile in the “Create Profile” API call - but, that’s optional. These can be added later on with “Update Profile” API call as well. However, adding those in the “Create Profile” keeps the profile consistent when fetched later on while displaying the dashboard screen.
For a social login, you need to call the “Set Token” API from the “Social Graph” module to submit the OAuth access token that you would retrieve from the social auth SDK (external).
It’s a good idea to start a background loop at this point to periodically fetch in-app notifications using the “Get Notifications” API from “Notifications” module. These notifications can convey events that happened in the system related to the user while the user was away. For a new user, there would generally be no pending notifications.