Page History

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If you are upgrading from a previous version, please make sure to read the SDK's Change Log.

Show If

grouptech-writers(editors)
Include PageTemplate Internal Notice Box 3 Do Not Share BasicTemplate Internal Notice Box 3 Do Not Share Basic

Tech-Writers Only!

VerifyLogin FR for Consent -> Next release of SDK

https://docs.google.com/document/d/1BvtulZZ9hbzHF_icPpxZ4JIvmEC2p77sGa_1PAGkKlU/edit

 

Session Validation

The Android SDK can now track a user's current session and determine if there were changes to the API schema and trigger a re-authentication for the user when necessary. This can be used to invalidate a user's session if the version of their agreed consent is expired or if new required fields are added to the site's schema.

When using session verification, the client application if verification fails and allow the client to perform the necessary logic to re-authenticate the user.

Note

Session validation calls will only occur when the application is in the foreground.

 

Session Validation : Implementation

Updating the manifest.xml

In the AndroidManifest.xml -> application node add the following:

Code Block
<meta-data
	android:name="com.gigya.android.verifySessionInterval"
	android:value=60 />  // The verification call interval in seconds.

 

 

Create or Update Application class

Create (or update, if one exists) your application class and register our SDK to track activity lifecycle callbacks.

Code Block
public class MyApplication extends Application  {
	@Override
	public void onCreate() {
		super.onCreate();
		GSAPI.getInstance().registerActivityLifecycleCallbacks(this);
	}
}

If you needed to create a new class (above) you need to register the class in your AndroidManifest.xml:

Code Block
<application
	..
	android:name=".MyApplication"
	..
.. >
Warning

Registering the ActivityLifcycleCallbacks in the custom application class is mandatory for the Session validation to function smoothly. This allows the SDK to recognize when the app is in the foreground and only then verify the session.

 

Register for the pending session event

 

 

Code Block
private GSSessionVerificationReceiver mySessionVerificationReceiver  = new GSSessionVerificationReceiver(myActivityName) {
	@Override
	public void onSessionVerificationRecieve(@Nullable GSObject data) {
		If (data != null) { 
			… Your code here.
		}
    }	
}

 

 

Code Block
@Override
public void onStart() {
	super.onStart();
	LocalBroadcastManager.getInstance(this).registerReceiver(
		mySessionVerificationReceiver, 
		new IntentFilter(SessionVerificationTask.INTENT_FILTER));
}

@Override
public  void onStop() {
	super.onStop();
	LocalBroadcastManager.getInstance(this).unregisterReceiver(
		mySessionVerificationReceiver);
}

 

 

Session Validation : Example

 

 

Code Block
private GSSessionVerificationReceiver mySessionVerificationReceiver = new GSSessionVerificationReceiver(myActivityName) {
	@Override
	public void onSessionVerificationRecieve(@Nullable GSObject data) {
		// Will trigger only in the current resumed activity! That’s why we are supplying the activity name here for evaluation.
		If (data != null) { 
			onSessionVerifcationReceived(data);
		}
    }	
}

 

Start Function

Code Block
 private void onSessionVerificationReceived(GSObject data) {
	GSObject params = new GSObject();
	params.put(“screenSet”, “Default-RegistrationLogin”);
	params.put(“startScreen”, “gigya-complete-registration-screen”);
	params.put(“finalizeRegistration”, true);
	params.put(“deviceType”, “auto”);

	final String regToken = data.getString(“regToken”, “”);
	If (regToken.isEmpty()) {
		Return;
	}
	params.put(“regToken”, regToken);

	final gigyaApi = GSAPI.getInstance();
	gigyaApi.setAccuntsEventListener(
		new GSAccountsEventListener() {
			@Override
			public void onLogin(GSObject account, Object context) {
				// Session has been re-initialized!!
			}
			@Override
			public void onLogout(Object context) {
			
		}
	});

	gigyaApi,showPluginDialog(“accounts.screenSet”, params,
 		new GSPluginListener() {

		@Override
		public void onLoad(GSPluginFragment pluginFragment,
 			GSObjet event) {
			}

		@Override
		public void onEvent(GSPluginFragment pluginFragment,
 			GSObject event) {
			}

		@Override
		public void onError(GSPluginFragment pluginFragment,
 			GSObject error) {
			}
	}, null);
}

 

 

 

Include PageTemplate Internal Notice Box 5 Footer End Of Internal ContentTemplate Internal Notice Box 5 Footer End Of Internal Content 

Library Guide

Please follow these steps to integrate Gigya's Android library:

...

A call to GSAPI's getSession() method returns a GSSession Object that holds data for the current session. Calling getSession() on an invalid session may return a null value, so you should check that the session object is not null before calling the isValid() function. If the session is valid and the user is logged in isValid() will return true. Otherwise the return value is false. 

 

Include Page
Android Session Validation - Template
Android Session Validation - Template

 

Tracking Deep Link Referrals

...