Log In and Registration

The VoiceLayerClient provides the functionality for registering new users as well as logging returning users in.

Registration

To create a new user:

client.register("username", "email", "password");

or

client.register("username", "email", "password", new VoiceLayerRegistrationCallback() {
    @Override
    public void onRegistrationComplete(String username, String email, VoiceLayerException exception) {

    }
});

Log In

To log a user in for the first time:

VoiceLayerLoginResponse result = client.login("email", "password");

VoiceLayerUser user = result.getUser();
String sessionToken = result.token;

or

client.login("email", "password", new VoiceLayerLoginCallback() {
@Override
    public void onLoginComplete(VoiceLayerUser user, String token, VoiceLayerException exception) {

    }
});

Log In Using a Session Token

To log a returning user in with their session token:

VoiceLayerUser user = client.login("token");

or

client.login("token", new VoiceLayerLoginCallback() {
@Override
    public void onLoginComplete(VoiceLayerUser user, String sessionToken, VoiceLayerException exception) {

    }
});

Log the Authenticated User Out

To log a user out:

client.logout();

or

client.logout(new VoiceLayerLogoutCallback() {
    @Override
    public void onLogoutComplete(VoiceLayerException exception) {

    }
});