Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Facebook SDK for Android
25 students

Facebook SDK for Android

In this course we will learn the basics of the facebook SDK for android. From setting up the SDK to building a fb app.
Created bymy bringback
Last updated 7/2012
English

Course content

1 section17 lectures1h 51m total length
  • 1 - Introduction 2:49

    This is the introduction to the course.  We will cover what you are expected to have setup for the tutorial series, and what we will cover.

  • 2 Setting Up The Facebook SDK Within Eclipse4:31

    In this tutorial we will set up the facebook SDK so that we have access to the library in the Eclipse IDE.  The setup of sdks are more than often the most tidious process.  We will go nice and slow to make sure it is done correctly

  • 3 Setting Up Our App With Facebook6:54

    In this tutorial we will set up our application from facebook's side of things.  We will have to create our app on the facebook developers site.  This will give us access to our app id which we will need to use when developing our Android app. In this tutorial we will set up our android application with the Facebook developer site.  We will need to create a new app on the developer site and give it some information about our android application.

    In this video I will refer to the default location of the keytool that came with the android SDK, on Windows this location should be:

    C:Users.android

    on Mac this location is:

    /Users//.android/

    Then you will execute this code:

    keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

    Hit Enter, and type "android" as the password

  • 4 Login Setup10:49

    In this tutorial we will finally start getting into the development phase.

    This is the code for the Main Activity (StartingPlace)

    public class StartingPlace extends Activity implements OnClickListener {

    /** Called when the activity is first created. */

    ImageView pic, button;

    Facebook fb;

    @Override

    public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    String APP_ID = getString(R.string.APP_ID);

    fb = new Facebook(APP_ID);

    button = (ImageView)findViewById(R.id.login);

    pic = (ImageView)findViewById(R.id.picture_pic);

    button.setOnClickListener(this);

    updateButtonImage();

    }

    private void updateButtonImage() {

    // TODO Auto-generated method stub

    if(fb.isSessionValid()){

    button.setImageResource(R.drawable.logout_button);

    }else{

    button.setImageResource(R.drawable.login_button);

    }

    }

    @Override

    public void onClick(View v) {

    // TODO Auto-generated method stub

    if(fb.isSessionValid()){

    //button close our session - log out of facebook

    }else{

    //login to facebook

    }

    }

    }

    This is our main.xml file:

    xml version="1.0" encoding="utf-8"?>

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

        android:layout_width="fill_parent"

        android:layout_height="fill_parent"

        android:orientation="vertical" >

          <TextView

            android:layout_width="fill_parent"

            android:layout_height="wrap_content"

            android:text="@string/hello" />

    <ImageView

        android:id="@+id/login"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:src="@drawable/login_button"

        />

    <ImageView

        android:id="@+id/picture_pic"

        android:visibility="invisible"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

     

        />

    LinearLayout>

  • 5 Authorize And Logout9:02

    In this Facebook SDK for Android tutorial we will learn how to give our application access (or authorization) to communicate with Facebook.  We will set up our button to ask for this authorization, but we will also need a method to catch the information coming back from Facebook, or more specifically, we need to create an onActivityForResult method and with in that method create the Facebook authorizeCallback method.  We will also create a way for our application to "logout" or restrict that communication with Facebook.

  • 5 Authorize And Logout-Source Code4:54
    package com.mybringback.facebookapp; import java.io.IOException; import java.net.MalformedURLException; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageView; import an…
  • 6 Automatic Login Via Shared Preferences5:04

    In this Facebook SDK for Android tutorial we will setup our automatic login feature using the sharedPreferences to load up the access token and the access expires.  This will be a two part tutorial, and in this specific video we set up the code to load our access_token and access_expires variables.  in the next tutorial we will save the information to the sharedPreferences that we try and load in this tutorial.

  • 7 Saving Access Token And Expires5:06

    In this Facebook SDK for android tutorial we will save the access token and the access expires to our sharePreferences.  We will have to get this information after the user has successfully given our application access to Facebook.

  • 6&7 source code6:05
    package com.mybringback.facebookapp; import java.io.IOException; import java.net.MalformedURLException; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.os.Bundle; import android.view…
  • 8 Getting User 's Data With JSON6:17

    In this Facebook SDK for Android tutorial we will learn about getting facebook information from the user of our app.  We will get the person's name and profile picture quite simply.  This is achieved by making a request to Facebook asking for what we want and parsing the data for specific items, such as "name" or "id".

    android, Facebook, sdk, beginner, tutorial, tutorials, id, getting id, Facebook sdk, profile, picture, user, development, programming, using

  • 9 JSON And Facebook Graph Parsing8:09

    In this Facebook tutorial we will be accessing the Facebook graph api so we can get some information about the user, such as parsing their profile picture into a Bitmap.  We will also talk briefly about how JSON parsing works and what it looks like on the backend so we have a little bit better understanding of what we are doing.  I will also show you a list of other information we can parse from the Graph api on Facebook, which will be very simple yet very powerful.   And remember guys, with great power comes great responsibility.

    Thanks again for watching, I'm looking forward to all the great new Facebook apps that will be hitting the market soon.

  • 9-source9:48
    package com.mybringback.facebookapp; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android…
  • 10 Make A Simple Wall Post5:39

    In this Facebook tutorial we will make a simple wall post.  We will eventually add extra information to our post, but this tutorial will show how to make  a "wall post" to the user's wall (or "feed")  via our App.  Surprisingly this only takes one line of code, so most of the tutorial will mainly be covering the process of setting up our app with a new nice and shiny button.

  • 11 Swagger Posts With Facebook SDK5:46

    In this Facebook SDK tutorial for Android development, we will add some swagger to our simple post we created in the last tutorial.  More specifically we will learn how to add a name, a caption, description, a link, and a picture to our post.  As always the Facebook SDK makes this pretty easy for us to do.  I hope you enjoy!

  • 11-source StartingPlace.java13:06
    package com.mybringback.facebookapp; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android…
  • 11-source main.xml1:13
  • 12 Async Facebook Runner Setup6:13

    In this Facebook SDK tutorial for Android we will set up our Async Facebook Runner (AsyncFacebookRunner), which will create its own thread to handle facebook requests, so we won't slow down our GUI thread to a halt (meaning it will cause our application to become unresponsive and crash).  We won't get to use it in this tutorial however, because we will be organizing our code and setting up for the next tutorial.

Description

Social media is a must today.  We will cover all of the basics to get your application integrated with facebook.  We will learn about making post, retrieving friends, getting pics, etc.  This course is designed for beginner Android developers.  Let's have some fun.