Player Login Experience#

The default Login experience allows the player to log in, and create a new gamer account via any of these methods:

  • Sign in with Facebook

  • Sign in with Google

../_images/player_login_experience.png

In order to integrate this scene it’s important that the Facebook and Google apps used in the Rave integration are properly configured. Please see Integrating Third Party Authentication section for instructions on how to configure the social networks apps.

To integrate the Login experience:

RaveLoginScene loginScene = new RaveLoginScene(DemoStartActivity.this);
loginScene.setListener(new LoginSceneListener() {

  @Override
  public void onSceneComplete(boolean isAnonymous, boolean accountCreated, String pluginKeyName, boolean canceled, RaveException e) {
    if (canceled) {
      //handle cancellation here
    }
    else {
      //handle success here
    }
  }

});
loginScene.show();

Registering and Handling Login Callbacks#

RaveSocial provides key Scene and Login status callbacks that a developer can register and listen to.

Login Status Notification#

The general Login Callback (not to be confused with the RaveLoginScene callback, which is specific to Scene-based authentication flows) is used to notify the developer that a login status change of some kind has occurred. This is useful because it may indicate that some social features are now available.

Warning

  • In 4.3.0, the login listener triggers twice during SDK initialization. See Impact on Login Listener Behavior.

  • In 4.3.1, the login listener triggers once during SDK initialization, restoring the behavior prior to SDK 4.3.0. See Restoration of Login Status Listener Behavior.

  • The deprecated RaveLoginStatus values ERROR and NONE are no longer used and will be removed in a future version.

  • The exception parameter in onLoginStatusChanged is now always null and should be ignored. It will be removed in a future version.

RaveSocial.setLoginListener(new RaveLoginStatusListener() {
  @Override
  public void onLoginStatusChanged(@NonNull RaveLoginStatus status, @Nullable @Deprecated RaveException ignored) {
    if (RaveSocial.isLoggedInAsGuest()) {
      //handle guest access here
    }
    //post-login code here
  }
});

Directly Logging In to Authentication Providers#

If using the built-in login experiences is not desired, developer can build completely custom login experience using Rave’s login APIs.

Using our loginWith API, you can directly invoke a login via Facebook or Google. Please use the following constants:

  • Facebook

  • Google

RaveSocial.loginWith("Facebook", new RaveCompletionListener() {
  @Override
  public void onComplete(RaveException exception) {
        if (e != null) {
            // handle errors here
          } else {
            // handle success
          }
  }
});

Checking Readiness of Authentication Providers#

Just like with the direct login API - you can also see if an authentication provider is ready to be used. “Readiness” indicates that a user has connected this social account to their Rave Social account and also that the token or local authentication for this social account was successful. Call convenience functions in RaveSocial to check an authentication provider’s readiness. If a plugin is not ready but you desire a ready status, use the matching connect methods in RaveSocial to establish a connection with the the desired plugin.

RaveSocial.checkReadinessOf("Facebook", new RaveReadinessListener() {
  @Override
  public void onComplete(RaveReadyStatus status) {
    //handle result
  }
});

RaveSocial.connectTo("Facebook", new RaveCompletionListener() {
  @Override
  public void onComplete(RaveException exception) {
    if (exception) {
      // handle exception
    } else {
      // success
    }
  }
});

Player Profile Management Experience#

The profile management experience screen allows players to build out their game profile by adding a profile picture, email, and display name, as well as connecting various social networks to connect with friends.

To integrate the Profile Management experience:

RaveAccountInfoScene accountInfoScene = new RaveAccountInfoScene(DemoStartActivity.this);
accountInfoScene.setListener(new AccountInfoSceneListener() {

  @Override
  public void onSceneComplete(boolean loggedOut, boolean canceled, RaveException e) {
    //callback after scene is done
  }
});
accountInfoScene.show();