• Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
497
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
5
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. developersRe-engineering the Facebook SDK for Android Connor Treacy connor@fb.com @connortreacy
  • 2. In the last 30 days, Facebook sent users to Google Play & the Apple App Store 174m times
  • 3. 1 Billion monthly active users600M monthly active mobile users 40% of the top 400 mobile apps8 of the top 10 grossing mobile apps
  • 4. Share DrivesStories Traffic Your App
  • 5. 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
  • 6. Post-SDK 2.0....
  • 7. Android moved on MyAppActivity ! W NE Activity Fragments Activity Hierarchy App Ecosystem
  • 8. Facebook moved on Native App Platform App InstallImprovements Stability Traffic
  • 9. Developers expected more
  • 10. Objectives1. Restructure for additive features2. Native UI elements and Fragment support3. Build features for high-value scenarios
  • 11. Principles1. Low-risk upgrage path from SDK 2.02. Feature parity with Facebook SDK for iOS3. Better API stability
  • 12. Facebook SDK for Android 3.0.1 http://developers.facebook.com/android
  • 13. Better ModularityNative UI LoginButton FriendPickerFragment ProfilePictureView Graph Facebook GraphUser GraphObject.Factory FacebookActivity OpenGraphAction Core Session Request UiLifecycleHelper Settings
  • 14. Better API interaction RequestAsyncTask RequestBatch Facebook.request Request Your App FacebookError Response FacebookException FacebookRequestError FacebookAuthorizationException FacebookServiceException
  • 15. 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);
  • 16. 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>
  • 17. 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)  { ... }
  • 18. 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);
  • 19. Session Lifecyclenew Session() CREATED_TOKEN_LOADED session.open() valid Yes OPENED cache? OPENING Yes success? No CREATED session.openFor…() No CLOSED_LOGIN_FAILED
  • 20. Session Lifecycle session.close() CLOSED OPENED_TOKEN_UPDATED OPENED Yes success?session.reauthorizeFor…() No OPENED
  • 21. Feed Dialog
  • 22. FriendPickerFragment PlacePickerFragment
  • 23. Growing your app
  • 24. Growing your app Settings.publishInstallAsync(...);
  • 25. Facebook SDK 3.0.1 for Androiddevelopers.facebook.com/android