Skip to content

Getting Started with GetSocial Unity SDK

Welcome to the Getting Started section of the GetSocial documentation. Here you will find guides that describe how to accomplish a specific task with code samples you can re-use in your app.

System Requirements

To use GetSocial SDK your execution and development environment should match the following requirements:

  • Unity 5.2 or above
  • To deploy on Android:

    • Android v4.0.3 (SDK v15) or higher
    • Android Developers Tools (ADT) version 19 or above
    • Google Play Services library v6.1.11 or above (for push notifications)
  • To deploy on iOS:

    • Xcode 8 or above
    • iOS 8 or higher

Not sure if GetSocial is going to work in your specific configuration or need support for the earlier versions of Unity? Feel free to reach us via Intercom or email.

Adding GetSocial to Your App

Create App on the Dashboard

To start using GetSocial, you have to create a free account and login to GetSocial Dashboard. Dashboard provides a web interface to manage all GetSocial services.

  1. Login to GetSocial Dashboard.
  2. Open Add new app wizard.
  3. Fill in App name and upload App icon image.
  4. Select Unity platform and Finish the wizard.

Configure GetSocial Editor Plugin

  1. Download the latest GetSocial .unitypackage from the Downloads page.
  2. In your Unity project go to AssetsImport PackageCustom Package…, select downloaded .unitypackage and import all assets:

    Unity - Import all GetSocial Assets

  3. After the successful project build you have to see GetSocial menu:

    Unity - GetSocial Menu

  4. Configure GetSocial App Id, go to GetSocialEdit Settings:

    Unity - GetSocial Menu

    You can find GetSocial App id in the App settings section on the GetSocial Dashboard:

    GetSocial App Id

  5. If you do not plan to use GetSocial UI, you can uncheck Use GetSocial UI setting to remove UI binaries from the build.

  6. Validate Android and iOS Settings.

    After specifying App id GetSocial Unity plugin will get application configuration from the GetSocial Dashboard and display it inside Unity. You can change the values by clicking on them (Dashboard will be opened):

    Keystore SHA 256 hash

Configure Dependencies (optional)

To obtain more accurate data about installs and make attribution more reliable, GetSocial is using Google Play Install Referrer API. To add library to your project:

  1. Download install referrer library from Maven repository
  2. Add the downloaded AAR file to Plugins/Android folder

Enable Supported App Stores on the Dashboard

Next step is to enable Google Play and Apple App Store on the GetSocial Dashboard:

  1. On the App settings section → App information tab.
  2. Enable Google Play store → fill in Package name and Signing-certificate fingerprint fields.

    Create new app on GetSocial Dashboard

    Package name is the applicationId in your app-level build.gradle file.

    Signing-certificate fingerprint is a SHA-256 hash of the keystore you use to sign your application. To get it, open GetSocial settings in Unity, go to GetSocialEdit Settings:

    Keystore SHA 256 hash

  3. Enable Apple App Store → fill in Bundle ID, Team ID and optionally App Store ID fields:

    Create new app on GetSocial Dashboard

    Bundle ID is a part of the iOS App ID. You can find bundle identifier in the Xcode project → General Settings → Identity → Bundle Identifier.

    Team ID is a unique 10-character string generated by Apple that’s assigned to your team. You can find your Team ID using your Apple developer account → Membership.

    App Store ID number can be found in the iTunes store URL as the string of numbers directly after id. For Example, in https://itunes.apple.com/us/app/yourapp/id284709449 the ID is: 284709449.

GetSocial SDK Size

Android

Due to limited resources on mobile devices and 65k methods limitation in one DEX library size and added methods count play an important role in app development.

Below you can find size and method count values for GetSocial Android SDK v6.6.2. You can expect similar values for all future versions of the library.

Android Library Raw Aar Size Methods Count
getsocial-core.aar 0.67 MB 4331
getsocial-ui.aar 0.36 MB 2414

iOS

On iOS GetSocial SDK adds 5.2 MB to the application downloadable size. Please note that GetSocial.framework size included in Unity SDK is around 150 MB. Read why framework is so big on iOS.

Start Using GetSocial

At this point, you should be able to start using GetSocial. Let’s try to send our first Smart Invite with and without GetSocial UI.

GetSocial SDK does not work in Unity Editor

Please note, that GetSocial SDK in Unity Editor is mocked. To test SDK features run the app on the Android/iOS emulators or real devices.

GetSocial UI

GetSocial UI library contains easy to customize views for all GetSocial features, e.g. code below will create and show GetSocial Smart Invites view:

1
2
bool wasShown = GetSocialUi.CreateInvitesView().Show();
Debug.Log("Smart Invites view was shown: " + wasShown);

After invoking code above, GetSocial Smart Invites view will be shown:

GetSocial Smart Invites View

Why there are only a few apps?

The list of Smart Invites Channels in the view above will contain all social apps that are 1) enabled on the GetSocial Dashboard and 2) installed on the device.

GetSocial without UI

If you plan to build your own UI, you can remove GetSocial UI library from dependencies and use only GetSocial data layer. To run the test, add the code below to any button callback:

1
2
3
4
5
GetSocial.SendInvite(InviteChannelIds.Email,
    onComplete: () => Debug.Log("Invitation via EMAIL was sent"),
    onCancel: () => Debug.Log("Invitation via EMAIL was cancelled"),
    onFailure: (error) => Debug.LogError("Invitation via EMAIL failed, error: " + error.Message)
);

After calling this method email client will be opened:

GetSocial Smart Invite over Email

SDK Initialization

GetSocial SDK is auto-initialized, just provide a GetSocial App Id in the GetSocial settings in Unity editor, and we will do the magic.

Manual Initialization

If you want to initialize GetSocial SDK manually, check this topic.

Most of GetSocial APIs require the SDK to be initialized. You can check the SDK initialization state synchronously or asynchronously.

1
2
3
if (GetSocial.IsInitialized) {
    // use GetSocial
}

If you want to be notified about initialization complete, you can set an action, that will be invoked when SDK gets initialized or invoked immediately if it is already initialized:

1
2
3
GetSocial.WhenInitialized(() => {
    // GetSocial is ready to be used
});

For instance, you can use WhenInitialized to ensure GetSocial SDK is initialized to get referral data on the application start:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
public class Controller : MonoBehaviour
{
    ...
    void Awake()
    {
        ...
        GetSocial.WhenInitialized(() => {
            GetSocial.GetReferralData(...);
        });
        ...
    }
    ...
}

Demo Application

To showcase all GetSocial SDK features, we have created a simple demo application. Explore it on the GitHub.

Next Steps

Well-done! GetSocial SDK is now set up and ready to rock, check what you can do next:

Give us your feedback! Was this article helpful?

πŸ˜€ πŸ™