Getting Started with GetSocial Unity SDK¶
Welcome to Getting Started section of GetSocial documentation. Here you’ll find guides that describe how to accomplish a specific task with code samples you can re-use in your app.
In order to use GetSocial SDK your execution and development environment should match 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, need support for the earlier versions of Unity? Feel free to reach us via Intercom or firstname.lastname@example.org.
Creating a GetSocial Account¶
To start using GetSocial you have to create an account and login to GetSocial Dashboard. Dashboard provides a web interface to manage all GetSocial services.
Adding GetSocial to Your Project¶
- Download the latest GetSocial
.unitypackagefrom our GitHub repository.
- Open your Unity project.
Go to Assets → Import Package → Custom Package…, select downloaded
.unitypackageand import all assets:
After the the project build you have to see GetSocial menu:
Well-done, GetSocial SDK is now part of your project. Time to configure it.
Configure GetSocial SDK¶
Get your GetSocial App Id from the “App settings” section on the GetSocial Dashboard:
Open GetSocial settings, go to GetSocial → Edit Settings:
Press “Setup GetSocial” button to make required Unity project changes and copy GetSocial libraries to
- Fill in the GetSocial App Id from Step 1.
- Select GetSocial modules to include in the project. If you do not plan to use GetSocial UI, uncheck corresponding setting in “Enabled Modules” section.
Configure Android Build¶
To start using GetSocial on Android we have to configure few more options in the GetSocial menu.
- Open GetSocial settings, go to GetSocial → Edit Settings.
Open “Android Settings” section:
If your project do not have
AndroidManifest.xmlyet, you will see a button to create it. Press the button.
When Android Manifest will be in-place, press “Check Dependencies and AndroidManifest.xml” button, you will see result of analysis.
To start using GetSocial your Android Manifest must pass all dependencies checks and have properly configured permissions, meta tags and content provider. Press corresponding fix buttons in analysis results to configure manifest.
Configure iOS Build¶
Basic GetSocial features on iOS will work right after configuring App Id in the GetSocial Settings. Let’s move on to the next step.
Start Using GetSocial¶
If the previous steps were executed properly at this point you have to be able to start using GetSocial. Let’s try to send a GetSocial Smart Invite via Email.
GetSocial SDK do not work in Unity Editor
Please note, that GetSocial SKD in Unity Editor is mocked. To test SDK features run the app on the Android/iOS emulators or real devices.
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 UI module contains easy to customize views for all GetSocial features.
To start using GetSocial UI, create and show any of provided views, e.g. code below will create and show GetSocial Smart Invites view:
bool wasShown = GetSocialUi.CreateInvitesView().Show(); Debug.Log("Smart Invites view was shown: " + wasShown);
After invoking code above, GetSocial Smart Invites view will be shown:
The list of Smart Invites Channels in the view above will contain all social apps that are enabled on the GetSocial Dashboard and installed on the device.
Well-done! GetSocial SDK is now set up and ready to rock, check what you can do next: