Skip to content

GetSocial Gradle Plugin Reference

Introduction

GetSocial Gradle Plugin simplifies GetSocial Android SDK integration. It adds all GetSocial dependencies to Gradle and AndroidManifest.xml modifications automatically.

Adding Plugin To Project

  1. Add repository and classpath dependency to your top-level build.gradle:

    buildscript {
        repositories {
            ...
            maven {
                url "https://plugins.gradle.org/m2/"
            }
        }
        dependencies {
            ...
            classpath "im.getsocial:plugin:[0,1)"
        }
    }
    
  2. In the Android application project build.gradle apply im.getsocial plugin after com.android.application:

    apply plugin: 'com.android.application'
    apply plugin: 'im.getsocial'
    
    getsocial {
        appId "put-your-getsocial-app-id-here"
        ...
    }
    

Warning

GetSocial Gradle Plugin can be used with Android Applications only.

Plugin Configuration

GetSocial Gradle Plugin exposes following DSL for configuration:

apply plugin: 'im.getsocial'

getsocial {
    version "[SDK_VERSION]" // e.g. "6.12.0"
    appId "[YOUR_APP_ID]"
    autoInit true
    useUiLibrary true
    autoRegisterForPush true
    uiConfig "[CUSTOM_UI_CONFIG_DIRECTORY]" // e.g. "getsocial"
    foregroundNotifications false
    disableFacebookReferralCheck false
}

Where:

Property Required Default Min SDK version Description
appId + empty string 6.0.0 GetSocial App Id from the GetSocial Dashboard. More.
version - empty string 6.0.0 GetSocial SDK version to use. See available versions here. If version is not specified the latest GetSocial SDK is used.
autoInit - true 6.10.0 Automatically initialize GetSocial SDK. More about Manual Initialization
autoRegisterForPush - true 6.0.0 Automatically register for Push Notifications. More.
disableFacebookReferralCheck - false 6.25.0 When disabled GetSocial won’t check referral data using Facebook. Use this if you want to check it in your app.
useUiLibrary - true 6.0.0 If getsocial-ui library should be added to project dependencies. More.
uiConfig - empty string 6.4.0(6.7.0 for directory) Custom UI configuration directory or file. If not specified default UI configuration will be used. More.
foregroundNotifications - false 6.17.0 Show GetSocial notifications while app is in foreground. More.

Available Tasks

GetSocial Gradle plugin adds a helper tasks.

Task Description
printSigningCertificateSHA256 Print SHA 265 fingerprints for all signing configurations. You’ll need signing certificate fingerprints to configure app on the GetSocial Dashboard.

Product Flavor Support

GetSocial Gradle Plugin supports Product Flavors.

Where to use it:

  • Testing and production versions of your application with different GetSocial appId. Keep clear your production data.
  • Use different versions of GetSocial SDK to try new features.
  • Use different GetSocial UI themes.

Example of build.gradle using Product Flavors:

apply plugin: 'im.getsocial'

getsocial {
    appId "your-app-id"
    autoRegisterForPush false
}

android {
    ...
    productFlavors {
        testingApp {
            getsocial {
                appId "testing-app-id"
            }
        }
        customUiApp {
            getsocial {
                uiConfig "custom"
            }
        }
        selfWrittenUi {
            getsocial {
                useUiLibrary false
            }
        }
        oldGetSocialVersion {
            getsocial {
                version "6.5.0"
            }
        }
    }
}
...

If you did not specify some configuration in the flavor, project configuration is used as the fallback.

Give us your feedback! Was this article helpful?

😀 🙁