class: co.ravesocial.sdk.RaveSocial
Listeners#
RaveCompletionListener#
Common completion listener:
public void onComplete(RaveException exception);
Parameters:
exception
- An exception or null if no error occurred
initializeRave#
Initialize the SDK:
public static void initializeRave(Context context)
Parameters:
context
- An Android Context
initializeRave (with callback)#
Initialize the SDK and callback on completion:
public static void initializeRave(Context context, RaveCompletionListener listener)
Parameters:
context
- An Android Context
listener
- A completion listener which is called after initialization is complete (see RaveCompletionListener)
initializeRaveWithConfig#
Initialize the SDK with a custom JSON config source:
public static void initializeRaveWithConfig(Context context, InputStream inputStream)
Parameters:
context
- An Android Context
inputStream
- An input stream which provides custom configuration JSON
initializeRaveWithConfig (with callback)#
Initialize the SDK with a custom JSON config source and callback on completion:
public static void initializeRaveWithConfig(Context context, InputStream inputStream, RaveCompletionListener listener)
Parameters:
context
- An Android Context
inputStream
- An input stream which provides custom configuration JSON
listener
- A completion listener which is called after initialization is complete (see RaveCompletionListener)
getVolatileRaveId#
Returns a Rave Id after initialization call has returned. Value may change after ready callback has fired:
public static String getVolatileRaveId();
Returns: Best guess UUID for the Rave user prior to completing initialization
connectTo#
Attention
Rather than implementing a fully custom control for connecting your users we suggest as best practice that you instead use your custom UI to wrap one of our connect controllers. Please read Adding a Facebook (or other social provider) button to your App.
Connect the current user to an authentication provider
public static void connectTo(final String pluginKeyName, final RaveCompletionListener listener)
Parameters:
pluginKeyName
- The KeyName of the authentication provider plugin
listener
- A completion listener (see RaveCompletionListener)
loginWith#
Attention
Rather than implementing a fully custom control for connecting your users we suggest as best practice that you instead use your custom UI to wrap one of our connect controllers. Please read Adding a Facebook (or other social provider) button to your App.
Logs in with an authentication provider. Make sure the current user isn’t already authenticated in before use. This will either connect the current anonymous user to the provider, or it will create a new session.
public static void loginWith(final String pluginKeyName, final RaveCompletionListener listener)
Parameters:
pluginKeyName
- The KeyName of the authentication provider plugin
listener
- A completion listener (see RaveCompletionListener)
disconnectFrom#
Disconnects the current user from an authentication provider
public static void disconnectFrom(final String pluginKeyName, RaveCompletionListener listener)
Parameters:
pluginKeyName
- The KeyName of the authentication provider plugin
listener
- A completion listener (see RaveCompletionListener)
logOut#
Logs the current user out of Rave. Deletes the current session and clears the cache.
It is highly recommended to use the callback version of logOut instead of this to avoid interfering with automatic guest login.
If the setting RaveSettings.General.AutoGuestLogin is enabled, a new guest account will be logged in immediately.
public static void logOut()
logOut (with callback)#
Logs the current user out of Rave. Deletes the current session and clears the cache.
Providing a null listener will result in operations such as automatic guest login and session deletion happening asynchronously. To guarantee that a race does not happen with any other authentication actions, it is highly recommended that a listener be set and that no other Rave APIs be called until the listener has called back.
If the setting RaveSettings.General.AutoGuestLogin is enabled, a new guest account will be logged in immediately.
public static void logOut(RaveCompletionListener listener)
Parameters:
listener
- A completion listener (see RaveCompletionListener)
loginAsGuest#
Logs in as a guest account. Do not call this if already logged in. This will not work if the setting RaveSettings.General.AutoGuestLogin is enabled, as guest login is controlled by Rave in that case and cannot be explicitly controlled.
public static void loginAsGuest(RaveCompletionListener listener)
Parameters:
listener
- A completion listener (see RaveCompletionListener)
getCurrentUser#
Gets the current user from cache if the user is logged in and cached user data is available:
public static RaveUser getCurrentUser()
checkReadinessOf#
Checks the state of an authentication provider to determine if it is ready to use A plugin is “Ready” if it has a token available from the provider and the current user is connected with a matching ID to the token:
public static void checkReadinessOf(final String pluginKeyName, final RaveReadinessListener listener)
Parameters:
pluginKeyName
- The KeyName of the authentication provider plugin
listener
- A readiness listener
isPluginReady#
Returns the cached value of the last time an authentication provider was checked for readiness. A plugin is “Ready” if it has a token available from the provider and the current user is connected with a matching ID to the token:
public static boolean isPluginReady(final String pluginKeyName)
Parameters:
pluginKeyName
- The KeyName of the authentication provider plugin
Returns: true if the authentication provider is ready, false if not
isLoggedIn#
Returns if there is an active session in any state (Guest, Authenticated or otherwise).
public static boolean isLoggedIn()
Returns: true if there is an active session, false if not
isLoggedInAsGuest#
Returns if there is an active session and the session is for a user in an anonymous (guest) state:
public static boolean isLoggedInAsGuest()
Returns: true if the current user is a guest, false if not or if there is no session
isPersonalized#
Returns if there is an active session and the session is for a user in personalized state:
public static boolean isPersonalized()
Returns: true if the current user is personalized, false if not or if there is no session
isAuthenticated#
Returns if there is an active session and the session is for a user in authenticated state:
public static boolean isAuthenticated()
Returns: true if the current user is authenticated, false if not or if there is no session
isNetworkAvailable#
Returns if there is a network connection available:
public static boolean isNetworkAvailable(Context context)
Parameters:
context
- An Android Context
Feature Manager Access#
All feature managers are available through the RaveSocial class.
achievementsManager
- Achievements Manager
authenticationManager
- Authentication Manager
contactsManager
- Contacts Manager
giftsManager
- Gifts Manager
leaderboardsManager
- Leaderboards Manager
promotionsManager
- Promotions Manager
sharingManager
- Sharing Manager
usersManager
- Users Manager