Janrain: User management platform for the social web

JREngage Class Reference

The JREngage class provides methods for configuring the Engage for Android library and initiating authentication and social sharing. More...

List of all members.

Get the JREngage Instance

Methods that initialize and return the shared JREngage instance

static JREngage initInstance (Activity activity, String appId, String tokenUrl, JREngageDelegate delegate)
static JREngage initInstance (Context context, String appId, String tokenUrl, JREngageDelegate delegate)
static JREngage getInstance ()

Manage Authenticated Users

Methods that manage authenticated users remembered by the library

void signoutUserForProvider (String provider)
void signoutUserForAllProviders ()
void setAlwaysForceReauthentication (boolean force)

Cancel the JREngage Dialogs

Methods to cancel authentication and social publishing

void cancelAuthentication ()
void cancelPublishing ()

Server-side Authentication

Methods to configure server-side authentication

void setTokenUrl (String newTokenUrl)

Manage the JREngage Delegates

Add/remove delegates that implement the JREngageDelegate interface

synchronized void addDelegate (JREngageDelegate delegate)
synchronized void removeDelegate (JREngageDelegate delegate)

Show the JREngage Dialogs

Methods that display the Engage for Android dialogs which initiate authentication and social publishing

void showAuthenticationDialog ()
void showAuthenticationDialog (boolean skipReturningUserLandingPage)
void showSocialPublishingDialog (JRActivityObject activity)
void showSocialPublishingFragment (JRActivityObject activity, FragmentActivity hostActivity, int containerId, boolean addToBackStack, Integer transit, Integer transitRes, Integer customEnterAnimation, Integer customExitAnimation)
void showSocialPublishingFragment (JRActivityObject activity, FragmentActivity hostActivity, int containerId)
JRPublishFragment createSocialPublishingFragment (JRActivityObject activity)

Enable a Subset of Providers

Methods that configure at runtime a subset of providers to use with the JREngage dialogs. These methods can only configure a subset of the configured and enabled providers found on your Engage application's dashboard.

void setEnabledAuthenticationProviders (List< String > enabledProviders)
void setEnabledAuthenticationProviders (String[] enabledProviders)
void setEnabledSharingProviders (List< String > enabledSharingProviders)
void setEnabledSharingProviders (String[] enabledSharingProviders)

Detailed Description

The JREngage class provides methods for configuring the Engage for Android library and initiating authentication and social sharing.

Prior to using the Engage for Android library, you must already have an application on http://rpxnow.com. This is all that is required for basic authentication, although some providers require extra configuration (which can be done through your application's Dashboard). For social publishing, you will need to configure your Engage application with the desired providers.

You may optionally implement server-side authentication. When configured, the Engage for Android library can post the user's authentication token to a URL on your server: the token URL. Your server can complete authentication, access more of the Engage web API, log the authentication, etc. and the server's response will be passed back through to your Android application.

To use JREngage:


Member Function Documentation

static JREngage initInstance ( Activity  activity,
String  appId,
String  tokenUrl,
JREngageDelegate  delegate 
) [static]

Initializes and returns the singleton instance of JREngage.

Parameters:
activityThe Android Activity, used for access to system resources (e.g. global preferences). This value cannot be null
appIdYour 20-character application ID. You can find this on your application's Engage Dashboard at http://rpxnow.com. This value cannot be null
tokenUrlThe URL on your server where you wish to complete authentication, or null. If provided, the JREngage library will post the user's authentication token to this URL where it can used for further authentication and processing. When complete, the library will pass the server's response back to the your application
delegateThe delegate object that implements the JREngageDelegate interface
Returns:
The shared instance of the JREngage object initialized with the given appId, tokenUrl, and delegate. If the given appId is null, returns null
static JREngage initInstance ( Context  context,
String  appId,
String  tokenUrl,
JREngageDelegate  delegate 
) [static]

Initializes and returns the singleton instance of JREngage.

Deprecated:
Use initInstance(Activity, String, String, JREngageDelegate) instead.
Parameters:
contextThe Android Activity, used for access to system resources (e.g. global preferences). This value cannot be null
appIdYour 20-character application ID. You can find this on your application's Engage Dashboard at http://rpxnow.com. This value cannot be null
tokenUrlThe URL on your server where you wish to complete authentication, or null. If provided, the JREngage library will post the user's authentication token to this URL where it can used for further authentication and processing. When complete, the library will pass the server's response back to the your application
delegateThe delegate object that implements the JREngageDelegate interface
Returns:
The shared instance of the JREngage object initialized with the given appId, tokenUrl, and delegate. If the given appId is null, returns null
static JREngage getInstance ( ) [static]

Returns the singleton instance, provided it has been initialized.

Returns:
The JREngage instance if properly initialized, null otherwise
void signoutUserForProvider ( String  provider)

Remove the user's credentials for the given provider from the library.

Parameters:
providerThe name of the provider on which the user authenticated. For a list of possible strings, please see the List of Providers
void signoutUserForAllProviders ( )

Remove the user's credentials for all providers from the library.

void setAlwaysForceReauthentication ( boolean  force)

Specify whether the Engage for Android library will require the user to reauthenticate. Reauthentication will require the user to re-enter their password.

Parameters:
forcetrue if the library should force reauthentication for all providers or false if the library should allow cached credentials to authenticate the user
void cancelAuthentication ( )

Stops the authentication flow. This finishes all Engage for Android activities and returns the calling Activity to the top of the application's activity stack.

void cancelPublishing ( )

Stops the publishing flow. This finishes all Engage for Android activities and returns the calling Activity to the top of the application's activity stack.

void setTokenUrl ( String  newTokenUrl)

Specify a token URL (potentially a different token URL than the one the library was initialized with).

Parameters:
newTokenUrlThe new token URL you wish authentications to post the Engage auth_info token to
synchronized void addDelegate ( JREngageDelegate  delegate)

Add a JREngageDelegate to the library.

Parameters:
delegateThe object that implements the JREngageDelegate interface
synchronized void removeDelegate ( JREngageDelegate  delegate)

Remove a JREngageDelegate from the library.

Parameters:
delegateThe object that implements the JREngageDelegate interface
void showAuthenticationDialog ( )

Begins authentication. The library will start a new Android Activity and take the user through the sign-in process.

void showAuthenticationDialog ( boolean  skipReturningUserLandingPage)

Begins authentication. The library will start a new Android Activity and take the user through the sign-in process.

Parameters:
skipReturningUserLandingPagePrevents the dialog from opening to the returning-user landing page when true. That is, the dialog will always open straight to the list of providers. The dialog falls back to the default behavior when false
Note:
If you always want to force the user to re=enter his/her credentials, pass true to the method setAlwaysForceReauthentication().
void showSocialPublishingDialog ( JRActivityObject  activity)

Begin social publishing. The library will start a new Android Activity enabling the user to publish a social share. The user will also be taken through the sign-in process, if necessary.

Parameters:
activityThe activity you wish to share
void showSocialPublishingFragment ( JRActivityObject  activity,
FragmentActivity  hostActivity,
int  containerId,
boolean  addToBackStack,
Integer  transit,
Integer  transitRes,
Integer  customEnterAnimation,
Integer  customExitAnimation 
)

Begin social publishing. The library will display a new Android Fragment enabling the user to publish a social share. The user will also be taken through the sign-in process, if necessary.

Parameters:
activityThe activity you wish to share
hostActivityThe android.support.v4.app.FragmentActivity which will host the publishing fragment
containerIdThe resource ID of a FrameLayout to embed the publishing fragment in
addToBackStackTrue if the publishing fragment should be added to the back stack, false otherwise
transitSelect a standard transition animation for this transaction. See FragmentTransaction.setTransition. Null for not set
transitResSet a custom style resource that will be used for resolving transit animations. Null for not set
customEnterAnimationSet a custom enter animation. May be null if-and-only-if customExitAnimation is also null
customExitAnimationSet a custom exit animation. May be null if-and-only-if customEnterAnimation is also null
void showSocialPublishingFragment ( JRActivityObject  activity,
FragmentActivity  hostActivity,
int  containerId 
)

Begin social publishing. The library will display a new Android Fragment enabling the user to publish a social share. The user will also be taken through the sign-in process, if necessary. This simple variant displays the Fragment, does not add it to the Fragment back stack, and uses default animations.

Parameters:
activityThe activity you wish to share
hostActivityThe android.support.v4.app.FragmentActivity which will host the publishing fragment
containerIdThe resource ID of a FrameLayout to embed the publishing fragment in
JRPublishFragment createSocialPublishingFragment ( JRActivityObject  activity)

Create a new android.support.v4.Fragment for social publishing. Use this if you wish to manage the FragmentTransaction yourself.

Parameters:
activityThe JRActivityObject to share, may not be null
Returns:
The created Fragment, or null upon error (caused by library configuration failure)
void setEnabledAuthenticationProviders ( List< String >  enabledProviders)

Sets the list of providers that are enabled for authentication. This does not supersede your RP's deplyoment settings for Android sign-in, as configured on rpxnow.com, it is a supplemental filter to that configuration.

Parameters:
enabledProvidersA list of providers which will be enabled. This set will be intersected with the set of providers configured on the Engage Dashboard, that intersection will be the providers that are actually available to the end-user.
void setEnabledAuthenticationProviders ( String[]  enabledProviders)

Convenience variant of setEnabledAuthenticationProviders(List<String>)

Parameters:
enabledProvidersAn array of providers which will be enabled. This set will be intersected with the set of providers configured on the Engage Dashboard, that intersection will be the providers that are actually available to the end-user.
void setEnabledSharingProviders ( List< String >  enabledSharingProviders)

Sets the list of providers that are enabled for social sharing. This does not supersede your RP's deplyoment settings for Android social sharing, as configured on rpxnow.com, it is a supplemental filter to that configuration.

Parameters:
enabledSharingProvidersWhich providers to enable for authentication, null for all providers. A list of social sharing providers which will be enabled. This set will be intersected with the set of providers configured on the Engage Dashboard, that intersection will be the providers that are actually available to the end-user.
void setEnabledSharingProviders ( String[]  enabledSharingProviders)

Convenience variant of setEnabledSharingProviders(List<String>)

Parameters:
enabledSharingProvidersAn array of social sharing providers which will be enabled. This set will be intersected with the set of providers configured on the Engage Dashboard, that intersection will be the providers that are actually available to the end-user.

The documentation for this class was generated from the following file:
  • /Users/nathan/android-code/engage.android/JREngage/src/com/janrain/android/engage/JREngage.java
Copyright © 2017 Janrain, Inc.