Android SDK Setup

From Social ID Developers
Jump to: navigation, search


Configure CoffeeBean SDK in your app

You'll need 3 variables to configure the SDK:

Download the SDK

Download the SDK

Import the AAR file into your existing AndroidStudio as a new module and update your project and app .gradle files to include the new module.

Project settings.gradle file:

 include ':socialidsdk'

App specific app/build.gradle file:

 dependencies {
   implementation project(':socialidsdk')

Android Manifest

Add the following definitions to AndroidManifest.xml immediately before opening the <application> tag:

 <uses-permission android:name="android.permission.INTERNET" />
 <uses-permission android:name="android.permission.USE_CREDENTIALS" />
 <!-- BEGIN: use this if you need push notification support -->
 <uses-permission android:name="android.permission.WAKE_LOCK" />
 <uses-permission android:name="android.permission.VIBRATE" />
 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
 <uses-permission android:name="" />
 <uses-permission android:name="com.YOUR_PACKAGE.C2D_MESSAGE" />
 <!-- END: use this if you need push notification support -->

Add the following definitions to AndroidManifest.xml inside the <application> tag:

 <!-- BEGIN: use this if you need push notification support -->
     android:permission="" >
         <action android:name="" />
         <category android:name="com.YOUR_PACKAGE" />
     android:enabled="false" >
         <action android:name="" />
         <category android:name="com.YOUR_PACKAGE" />
 <service android:name="com.coffeebeantech.socialidsdk.notification.NotificationService" />
 <service android:name="com.coffeebeantech.socialidsdk.registration.RegistrationService" />
 <!-- END: use this if you need push notification support -->


Add the following variables to your resources file:

 <!-- Social Id configuration -->
 <string name="login_app_id">LOGIN_APP_ID</string>;
 <string name="login_app_client_secret">LOGIN_APP_CLIENT_SECRET</string>;
 <!-- Google Project Number (if you need push notification support) -->
 <string name="sender_id">SENDER_ID</string>;


Add the following import statements to your Activity:

 import com.coffeebeantech.socialidsdk.SocialId;
 import com.coffeebeantech.socialidsdk.notification.NotificationParameters;

At your Activity onCreate method, call SocialId.configLoginProviders with the desired providers configuration and then call SocialId.config to set your Social-ID configuration using the resources set before:

 // pass the providers configuration that will be set
 SocialId.configLoginProviders(facebookConfiguration, gplusConfiguration, linkedinConfiguration, twitterConfiguration, emailConfiguration);
 // with push notifications support
 // without push notifications support
 SocialId.config(this, "LOGIN_APP_ID", "LOGIN_APP_CLIENT_SECRET");

Add Facebook Login to your app

Before starting to add the Facebook SDK, you must allow your Facebook App to receive requests from your Android project.

  • At the Facebook for developers page, find your Facebook App at My Apps
  • Go to Settings > Basic
  • At the end of page click on "Add a Platform" and then select "Android"
  • Add your project package name at "Google Play Package Name" and your default activity class name at "Class Name"
  • Export your Development Key Hash using the instructions for your operating system, add the exported key to "Key Hashes" and then "Save Changes" to proceed to next steps
 $ keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64 
You need the folowing:
  • Key and Certificate Management Tool (keytool) from the Java Development Kit
  • openssl-for-windows openssl library for Windows from the Google Code Archive
 $ keytool -exportcert -alias androiddebugkey -keystore "C:\Users\USERNAME\.android\debug.keystore" | "PATH_TO_OPENSSL_LIBRARY\bin\openssl" sha1 -binary | "PATH_TO_OPENSSL_LIBRARY\bin\openssl" base64

Add the Facebook maven repository to your app/build.gradle before the dependencies area and add the latest Facebook SDK dependency to your list of dependencies:

 repositories {
 dependencies { 
   implementation ''

Android Manifest

Add the Facebook ApplicationId that will be used in your AndroidManifest.xml inside the <application> tag as following:

    android:value="@string/facebook_app_id" />
 <!-- If you want to make changes to the Facebook Login Activity you can do changes using the tag below -->
 <activity android:name="com.facebook.FacebookActivity"
    android:label="@string/app_name" />


Add the following variables to your resources file:

 <string name="facebook_app_id">FACEBOOK_APP_ID</string>
 <string-array name="facebook_permissions">


Initializes a new Facebook configuration and set the permissions:

 // Facebook configuration
 FacebookConfiguration facebookConfiguration = new FacebookConfiguration()

Add Twitter Login to your app

Add the twittersdk:// to your Twitter App Callback URLs to allow an Android project to use it.

Add the Twitter JCenter repository to your app/build.gradle before the dependencies area and add the Twitter SDK dependency to your list of dependencies:

 repositories {
 dependencies {
   implementation('') {
     transitive = true;


 <string name="twitter_key">TWITTER_KEY</string>
 <string name="twitter_secret">TWITTER_SECRET</string>


Initializes a new Twitter configuration and set the credentials:

 // Twitter configuration
 TwitterConfiguration twitterConfiguration = new TwitterConfiguration()

Add Google Login to your app

To add the Google Login to your Android project you must:

  • Have an Android and a Web Application "OAuth client ID" Credentials
    • The Android Credential must be set with the SHA1 signing-certificate fingerprint and the Package Name to the Login with Google work.

Example to export the SHA1 from the debug key:

 $ keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v

Add the latest Google GCM and Auth SDK dependency to your list of dependencies:

 dependencies {
   implementation ''
   implementation ''


Add the Client ID from the created Web Application credential to your resources file:

 <!-- Google Client Server ID -->
 <string name="google_client_server_id">"WEB_APPLICATION_CLIENT_ID"</string>; 


Initializes a new Gplus configuration and set the client server id with the Web Application client ID:

 // Google+ configuration
 GplusConfiguration gplusConfiguration = new GplusConfiguration()

Add Linkedin Login to your app

Add the following content to the assets/ file. Custom Permissions must be a single string split by a comma (ex: r_liteprofile,r_emailaddress). Ensure the assets folder is at the same level as the res folder.



Add the Linkedin Callback URI to your resources file:

 <!-- Linkedin Callback URI -->
 <string name="linkedin_callback_uri">LINKEDIN_CALLBACK_URI</string>


Initializes a new Linkedin configuration and set the callback uri:

 // LinkedIn configuration
 LinkedinConfiguration linkedinConfiguration = new LinkedinConfiguration()
Personal tools