Class UserService

  • All Implemented Interfaces:

    
    public final class UserService
    extends MobileService
                        

    Represents the service to retrieve user information from mobile server.

    • Method Detail

      • init

         Unit init(Application application, String apiKey)

        Initializes the mobile service

      • onStateChange

         Unit onStateChange(ApplicationState state)

        Notified when application state changes. This function will be called on Main thread.

      • logoutUser

        @JvmOverloads() final Job logoutUser(ServiceListener<Boolean> listener, String userId, String clientId, Boolean keepTokenValid)

        Logouts the current user for Java client. clientId is used in the case of OAuth with CCT/TWA/Browser, the client code needs to make sure the network is available before calling this API, otherwise, the logout process is not able to clear the cookies of this user.

      • logoutUser

        @JvmOverloads() final Job logoutUser(ServiceListener<Boolean> listener, String userId, String clientId)

        Logouts the current user for Java client. clientId is used in the case of OAuth with CCT/TWA/Browser, the client code needs to make sure the network is available before calling this API, otherwise, the logout process is not able to clear the cookies of this user.

      • logoutUser

        @JvmOverloads() final Job logoutUser(ServiceListener<Boolean> listener, String userId)

        Logouts the current user for Java client. clientId is used in the case of OAuth with CCT/TWA/Browser, the client code needs to make sure the network is available before calling this API, otherwise, the logout process is not able to clear the cookies of this user.

      • logoutUser

        @JvmOverloads() final Job logoutUser(ServiceListener<Boolean> listener)

        Logouts the current user for Java client. clientId is used in the case of OAuth with CCT/TWA/Browser, the client code needs to make sure the network is available before calling this API, otherwise, the logout process is not able to clear the cookies of this user.

      • logoutUser

        @JvmOverloads() final ServiceResult<Boolean> logoutUser(String userId, String clientId, Boolean keepTokenValid)

        Signs out the current onboarded user.

        Parameters:
        userId - optional parameter.
        clientId - is used in the case of OAuth authentication with CCT/TWA/Browser, if it's provided, the client code needs to ensure the network is available, otherwise, the logout process is not able to clear the session cookies in the browser.
        keepTokenValid - is to say whether keep the token valid after the logout call.
      • logoutUser

        @JvmOverloads() final ServiceResult<Boolean> logoutUser(String userId, String clientId)

        Signs out the current onboarded user.

        Parameters:
        userId - optional parameter.
        clientId - is used in the case of OAuth authentication with CCT/TWA/Browser, if it's provided, the client code needs to ensure the network is available, otherwise, the logout process is not able to clear the session cookies in the browser.
      • logoutUser

        @JvmOverloads() final ServiceResult<Boolean> logoutUser(String userId)

        Signs out the current onboarded user.

        Parameters:
        userId - optional parameter.
      • deleteRegistration

        @JvmOverloads() final Job deleteRegistration(ServiceListener<Boolean> listener, String userId, String clientId)

        Deletes the registration of the current user. For Java client. clientId is for OAuth with CCT/TWA/Browser case, the client code needs to make sure the network is available before calling this API.

      • deleteRegistration

        @JvmOverloads() final Job deleteRegistration(ServiceListener<Boolean> listener, String userId)

        Deletes the registration of the current user. For Java client. clientId is for OAuth with CCT/TWA/Browser case, the client code needs to make sure the network is available before calling this API.

      • deleteRegistration

        @JvmOverloads() final Job deleteRegistration(ServiceListener<Boolean> listener)

        Deletes the registration of the current user. For Java client. clientId is for OAuth with CCT/TWA/Browser case, the client code needs to make sure the network is available before calling this API.

      • deleteRegistration

        @JvmOverloads() final ServiceResult<Boolean> deleteRegistration(String userId, String clientId)

        Deletes the registration of the current user. 'device id' must be in the request header before calling this.

        clientId is for OAuth with CCT/TWA/Browser case, the client code needs to make sure the network is available before calling this API.

      • deleteRegistration

        @JvmOverloads() final ServiceResult<Boolean> deleteRegistration(String userId)

        Deletes the registration of the current user. 'device id' must be in the request header before calling this.

        clientId is for OAuth with CCT/TWA/Browser case, the client code needs to make sure the network is available before calling this API.

      • deleteRegistration

        @JvmOverloads() final ServiceResult<Boolean> deleteRegistration()

        Deletes the registration of the current user. 'device id' must be in the request header before calling this.

        clientId is for OAuth with CCT/TWA/Browser case, the client code needs to make sure the network is available before calling this API.

      • checkUserSession

         final ServiceResult<Boolean> checkUserSession(String currentUserId)

        Checks whether the current user session belongs to the user identified by the given currentUserId.

        For offline applications, one user may unlock the app with his/her passcode, then begin to work on the offline database operations, then later when the network is available, sync the changes to the server side. At this time, since for some reasons, this user might not use the correct session, this API is to make sure this case does not happen.

        When this API returns 'false', the client needs to remove the session and let the current user re-create the session.