Android SDK Upgrade Guide

Skip to end of metadata
Go to start of metadata

 

Upgrading from Version 3.3.1 to 3.3.2

In your Gradle file, replace 'com.google.android.gms:play-services-plus' with

dependencies {
...
compile 'com.google.android.gms:play-services-auth:8.4.0'
...
}

 

Upgrading from Version 3.2.2 to 3.3.0

Using Google+ native login on Android 6.0 (Marshmallow) requires that you ask the user for the 'GET_ACCOUNTS' permission at run-time.

  • Implement the onRequestPermissionsResult handler on the current Activity, from which the login request was sent.

 

@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
    if (GSAPI.getInstance().handleAndroidPermissionsResult(requestCode, permissions, grantResults))
        return;
    // handle other permissions result here
}

 

  • Login & addConnection methods now require reference to the current Activity.
  • When login using plugin as dialog (e.g., ScreenSet), there's no need to handle onRequestPermissionsResult, since the current Activity is part of the GigyaSDK and the handler exists internally.

Upgrading from Version 3.2.1 to 3.2.2

AndroidManifest Changes

Remove any previous Gigya activities from your AndroidManifest.xml. Add the following instead, and make sure you replace "YOUR-PACKAGE-NAME" with the package of your MainActivity:

 

<activity
    android:name="com.gigya.socialize.android.ui.HostActivity"
	android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"    
	android:theme="@android:style/Theme.Translucent.NoTitleBar" />

<activity
    android:name="com.gigya.socialize.android.login.providers.WebLoginActivity"
    android:theme="@android:style/Theme.Translucent.NoTitleBar"
    android:launchMode="singleTask"
    android:allowTaskReparenting="true" >
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="YOUR-PACKAGE-NAME" android:host="gsapi" />
    </intent-filter>
</activity>

 

Upgrading from Version 3.1.2 to 3.2

Upgrade Your Facebook SDK

The Gigya Android SDK was tested with Facebook Android SDK 4.1.0. Download the latest Facebook SDK here.

Update Facebook Permission Request

GSAPI's  requestFacebookPublishPermissions  method has been renamed to  requestNewFacebookPublishPermissions , and a new parameter was added to its callback listener. Make sure to update your method call.

Upgrading from Version 3.1 to 3.1.1

Upgrade Your Facebook SDK

The Gigya Android SDK was tested with Facebook Android SDK 3.19.
 

Update Facebook Permission Request

GSAPI's  requestFacebookPublishPermissions  method has been renamed to  requestNewFacebookPublishPermissions , and a new parameter was added to its callback listener. Make sure to update your method call.

 

Upgrading from Version 3.0 to Version 3.1

The new SDK version requires Google Play Services library version 4.2 and above for Google+ Native Login.

 

Upgrading from Versions Earlier than 3.0

This section takes you through the steps you need in order to upgrade an app that was developed with versions earlier than 3.0.

 

AndroidManifest Changes

Remove any previous Gigya activities from your AndroidManifest.xml. Add the following instead, and make sure you replace "YOUR-PACKAGE-NAME" with the package of your MainActivity:

 

<activity
    android:name="com.gigya.socialize.android.ui.HostActivity"
	android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"    
	android:theme="@android:style/Theme.Translucent.NoTitleBar" />

<activity
    android:name="com.gigya.socialize.android.login.providers.WebLoginActivity"
    android:theme="@android:style/Theme.Translucent.NoTitleBar"
    android:launchMode="singleTask"
    android:allowTaskReparenting="true" >
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="YOUR-PACKAGE-NAME" android:host="gsapi" />
    </intent-filter>
</activity>

 

 

GSAPI is now Singleton

In previous versions, you had to create, initialize, and retain an instance of the GSAPI class, and then use it for login and requests. Starting with 3.0, GSAPI has been refactored to use the singleton design pattern. This means you don't need to keep an instance anymore; instead you can use 'GSAPI.getInstance()'.
 
Initialization Method
The initialization method has also been changed. Replace your initialization code with this:

 

GSAPI.getInstance().initialize(this, "YOUR-API-KEY");

 

Also, some of GSAPI's properties has changed. Please see GSAPI's reference  for details.
 
Replace GSEventListener with GSSocializeEventListener
GSEventListener has been deprecated to make room for two namespace-specific listeners: GSSocializeEventListener and GSAccountsEventListener.
You may choose the one suitable to your needs.
 
Web Browser Authentication
In previous versions, login to social networks happened in a web view dialog inside the application. In 3.0, the default login behavior was changed to use the web browser instead.
If you would like to retain the old behavior (using webViews), you can add the following code after calling GSAPI.initialize:

 

GSAPI.getInstance().setLoginBehavior(GSAPI.LoginBehavior.WEBVIEW_DIALOG);

 

 
Note that this mode also forces Facebook Native Login to use web view authentication. If you would like it to use the Facebook app instead, add this to your login parameters:

 

GSObject params = new GSObject();
params.put("provider", "facebook");
params.put("facebookLoginBehavior", "NATIVE_WITH_FALLBACK");
GSAPI.getInstance().login(params, ...);

 

Facebook Login
Following Facebook's policy change (https://developers.facebook.com/blog/post/2013/06/26/october-2013-platform-changes/), native Android apps must not use their own web view for Facebook login.
This means that if your app isn't configured for Facebook Native Login, Facebook login will be disabled.
 
Because of this, the 'facebookExtraPermissions' param is obsolete. Facebook Native Login will request the permissions defined in your site's settings set by Gigya Platform.
If you would like to request additional permissions, add the 'facebookReadPermissions' to the login params.
 
Accessing Facebook SDK Token
GSSession.getFacebookToken() and GSSession.setFacebookToken() were removed.
If you would still like to access the token, you can get it by accessing the active session of the Facebook SDK:

 

String fbToken = com.facebook.AccessToken.getCurrentAccessToken().getToken();

 

 
Additional Changes
GSAPI.OPTION_SHOW_PROGRESS_ON_NAVIGATION was removed.