Droidcon2013 facebook sdk treacy
Upcoming SlideShare
Loading in...5

Droidcon2013 facebook sdk treacy






Total Views
Views on SlideShare
Embed Views



1 Embed 31

http://de.droidcon.com 31



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Droidcon2013 facebook sdk treacy Droidcon2013 facebook sdk treacy Presentation Transcript

  • developersRe-engineering the Facebook SDK for Android Connor Treacy connor@fb.com @connortreacy
  • In the last 30 days, Facebook sent users to Google Play & the Apple App Store 174m times
  • 1 Billion monthly active users600M monthly active mobile users 40% of the top 400 mobile apps8 of the top 10 grossing mobile apps
  • Share DrivesStories Traffic Your App
  • Android versions over time Source: bgr.com 4.1 Jellybean 100 4 Ice Cream 3 Honeycomb 80 2.3 Gingerbread 2.2 Froyo 2.1 Eclair 60 2.0 1.6 Donut 1.5 Cupcake 40 Dec 2009 20 June 2010 Dec 2010 June 2011 Dec 2011 SDK 1.0 June 2012 0 Dec 2012 SDK 3.0 SDK 3.0
  • Post-SDK 2.0....
  • Android moved on MyAppActivity ! W NE Activity Fragments Activity Hierarchy App Ecosystem
  • Facebook moved on Native App Platform App InstallImprovements Stability Traffic
  • Developers expected more
  • Objectives1. Restructure for additive features2. Native UI elements and Fragment support3. Build features for high-value scenarios
  • Principles1. Low-risk upgrage path from SDK 2.02. Feature parity with Facebook SDK for iOS3. Better API stability
  • Facebook SDK for Android 3.0.1 http://developers.facebook.com/android
  • Better ModularityNative UI LoginButton FriendPickerFragment ProfilePictureView Graph Facebook GraphUser GraphObject.Factory FacebookActivity OpenGraphAction Core Session Request UiLifecycleHelper Settings
  • Better API interaction RequestAsyncTask RequestBatch Facebook.request Request Your App FacebookError Response FacebookException FacebookRequestError FacebookAuthorizationException FacebookServiceException
  • Initializing with the SDK 2.0‣ Instantiate the Facebook object with your App ID‣ Most activity managed from the Facebook object fbconnection  =  new  Facebook("1123581321"); fbconnection.authorize(          getActivity(),            new  String[]  ("publish_actions",  “user_likes”),              dialogListener);
  • Initializing with the SDK 3.0‣ Greater separation of concerns: Session, Request, Response, UI elements‣ Set up the App ID through the string resources and Android Manifest files <string  name="app_id">480369938658210</string> ...        <meta-­‐data              android:name="com.facebook.sdk.ApplicationId"                android:value="@string/app_id"  /> </application>
  • Activity Lifecycle with SDK 2.0‣ Extend the FacebookActivity class‣ Handle session state changes by overriding the abstract method in FacebookActivity public  class  MainActivity  extends  FacebookActivity  { @Override protected  void  onSessionStateChange(    SessionState  state,  Exception  exception)  { ... }
  • Activity Lifecycle with SDK 3.0‣ Keep your own Activities‣ Instantiate a UiLifeCycleHelper and keep it in step with your Activity public  class  MainActivity  extends  WhateverYouWantActivity  { @Override public  void  onCreate(Bundle  savedInstanceState)  {        super.onCreate(savedInstanceState);        uiHelper  =  new  UiLifecycleHelper(this,  callback);        uiHelper.onCreate(savedInstanceState);
  • Session Lifecyclenew Session() CREATED_TOKEN_LOADED session.open() valid Yes OPENED cache? OPENING Yes success? No CREATED session.openFor…() No CLOSED_LOGIN_FAILED
  • Session Lifecycle session.close() CLOSED OPENED_TOKEN_UPDATED OPENED Yes success?session.reauthorizeFor…() No OPENED
  • Feed Dialog
  • FriendPickerFragment PlacePickerFragment
  • Growing your app
  • Growing your app Settings.publishInstallAsync(...);
  • Facebook SDK 3.0.1 for Androiddevelopers.facebook.com/android