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:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    buildscript {
        repositories {
            ...
            maven {
                url "https://plugins.gradle.org/m2/"
            }
        }
        dependencies {
            ...
            classpath "gradle.plugin.im.getsocial:plugin:[0,1)"
        }
    }
    
  2. In the Android application project build.gradle apply im.getsocial plugin after com.android.application:

    1
    2
    3
    4
    5
    6
    7
    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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
apply plugin: 'im.getsocial'

getsocial {
    version "6.7.0"
    appId "LK8A9cA0o07"
    autoInit true
    useUiLibrary true
    autoRegisterForPush true
    uiConfig "getsocial"
}

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.
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.

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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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 didn’t specify some configuration in the flavor, project configuration is used as fallback.

Give us your feedback! Was this article helpful?

😀 🙁