Android SDK Setup

From Social ID Developers
Revision as of 16:36, 6 November 2014 by Ariana.luna (Talk | contribs)
Jump to: navigation, search

Contents

Existing Project

Download the SDK

Import the zip file's contents into your existing Android project by extracting it into your "libs" folder. If your project does not already have a "libs" folder, create one at the root of the project by right-clicking the project and choosing "New" and then "Folder."

Download the SDK

Get your Social-ID data

You'll need 5 variables to configure the SDK:

Add the SDK to your app

Add the following import statements to your Activity:

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

Call SocialId.config from the onCreate method of your Application class to set your application SocialID configuration:

 SocialId.config(this, "SENDER_ID", "API_KEY", "API_SECRET", "LOGIN_APP_API_KEY", "LOGIN_APP_API_SECRET");

Add the following variables to res/values/strings.xml:

 <string name="app_id"></string> 
 <string name="client_id"></string> 
 <string name="client_secret"></string> 

Modify app 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.GET_ACCOUNTS" />
 <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="com.google.android.c2dm.permission.RECEIVE" />
 <permission
     android:name="com.YOUR_PACKAGE.C2D_MESSAGE"
     android:protectionLevel="signature" />    
 <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:

 <meta-data
     android:name="com.google.android.gms.version"
     android:value="@integer/google_play_services_version" />
 <meta-data
     android:name="com.facebook.sdk.ApplicationId"
     android:value="@string/app_id" />
 <meta-data
     android:name="com.coffeebeantech.socialidsdk.client_id"
     android:value="@string/client_id" />
 <meta-data
     android:name="com.coffeebeantech.socialidsdk.client_secret"
     android:value="@string/client_secret" />
 <activity android:name="com.facebook.LoginActivity" >
 </activity>
 <!-- BEGIN: use this if you need push notification support -->
 <receiver
     android:name="com.coffeebeantech.socialidsdk.notification.NotificationReceiver"
     android:permission="com.google.android.c2dm.permission.SEND" >
     <intent-filter>
         <action android:name="com.google.android.c2dm.intent.RECEIVE" />
         <category android:name="com.YOUR_PACKAGE" />
     </intent-filter>
 </receiver>
 <receiver
     android:name="com.coffeebeantech.socialidsdk.registration.ConnectivityMonitor"
     android:enabled="false" >
     <intent-filter>
         <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
         <category android:name="com.YOUR_PACKAGE" />
     </intent-filter>
 </receiver>
 <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 -->

New Project

Download & unzip the sample project

Download the project

Add the project to your workspace

Unzip the file and move the socialid-sample-android into your workspace directory.

In Eclipse, go to File → Import…

Click General → Existing Projects into Workspace

Make sure the "Select root directory" radio button is selected, and browse to your workspace directory.

In the Projects box, check the box next to ParseStarterProject and click Finish. (Note: if your workspace isn't already set up for Android, you may need to specify the location of the Android SDK in the Android tab in preferences, in order to get the project to compile.)

Get your SocialID data

You'll need 5 variables to configure the SDK:

Add the SDK to your app

Add the following import statements to your Activity:

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

Call SocialId.config from the onCreate method of your Application class to set your application SocialID configuration:

 SocialId.config(this, "SENDER_ID", "API_KEY", "API_SECRET", "LOGIN_APP_API_KEY", "LOGIN_APP_API_SECRET");

Add the following variables to res/values/strings.xml:

 <string name="app_id"></string> 
 <string name="client_id"></string> 
 <string name="client_secret"></string> 

Modify app 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.GET_ACCOUNTS" />
 <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="com.google.android.c2dm.permission.RECEIVE" />
 <permission
     android:name="com.YOUR_PACKAGE.C2D_MESSAGE"
     android:protectionLevel="signature" />    
 <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:

 <meta-data
     android:name="com.google.android.gms.version"
     android:value="@integer/google_play_services_version" />
 <meta-data
     android:name="com.facebook.sdk.ApplicationId"
     android:value="@string/app_id" />
 <meta-data
     android:name="com.coffeebeantech.socialidsdk.client_id"
     android:value="@string/client_id" />
 <meta-data
     android:name="com.coffeebeantech.socialidsdk.client_secret"
     android:value="@string/client_secret" />
 <activity android:name="com.facebook.LoginActivity" >
 </activity>
 <!-- BEGIN: use this if you need push notification support -->
 <receiver
     android:name="com.coffeebeantech.socialidsdk.notification.NotificationReceiver"
     android:permission="com.google.android.c2dm.permission.SEND" >
     <intent-filter>
         <action android:name="com.google.android.c2dm.intent.RECEIVE" />
         <category android:name="com.YOUR_PACKAGE" />
     </intent-filter>
 </receiver>
 <receiver
     android:name="com.coffeebeantech.socialidsdk.registration.ConnectivityMonitor"
     android:enabled="false" >
     <intent-filter>
         <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
         <category android:name="com.YOUR_PACKAGE" />
     </intent-filter>
 </receiver>
 <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 -->
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox