Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building Your First Social App - AnDevCon

Building Your First Social App - AnDevCon

Deck from AnDevCon Boston

beardouglas

May 29, 2013
Tweet

More Decks by beardouglas

Other Decks in Technology

Transcript

  1. developers Bear Douglas and Christine Abernathy github: beardouglas, caabernathy @beardigsit

    @caabernathy Building Your First Social App Wednesday, May 29, 13
  2. http://developers.facebook.com/android Wednesday, May 29, 13

  3. github.com/beardouglas/andevcon Wednesday, May 29, 13

  4. Login Wednesday, May 29, 13

  5. Facebook Login on Android Create a Facebook app Add the

    Facebook SDK to your project Add your Facebook App ID to your Android Manifest Add Facebook Login and start sharing Wednesday, May 29, 13
  6. The Facebook SDK for Android Native UI Graph Core LoginButton

    GraphUser FriendPickerFragment ProfilePictureView GraphObject.Factory OpenGraphAction Request UiLifecycleHelper Settings Session Wednesday, May 29, 13
  7. The Facebook SDK for Android Native UI Graph Core LoginButton

    GraphUser FriendPickerFragment ProfilePictureView GraphObject.Factory OpenGraphAction Request UiLifecycleHelper Settings Session Wednesday, May 29, 13
  8. Connecting to Facebook valid cache? new Session() session.openFor…() session.open() OPENED

    success? CLOSED_LOGIN_FAILED Yes Yes No No Wednesday, May 29, 13
  9. @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); uiHelper = new UiLifecycleHelper(

    getActivity(), callback); uiHelper.onCreate(savedInstanceState); } Wednesday, May 29, 13
  10. Demo Follow along: github.com/beardouglas/andevcon Wednesday, May 29, 13

  11. What’s next? Wednesday, May 29, 13

  12. Wednesday, May 29, 13

  13. Wednesday, May 29, 13

  14. Like Wednesday, May 29, 13

  15. Like play Wednesday, May 29, 13

  16. Like play Like Wednesday, May 29, 13

  17. Like play listen Like Wednesday, May 29, 13

  18. Like play listen Like read Wednesday, May 29, 13

  19. Like play listen Like watch read Wednesday, May 29, 13

  20. Like play listen Like pin watch read Wednesday, May 29,

    13
  21. Like play listen Like pin watch read check in Wednesday,

    May 29, 13
  22. The Graph API https://graph.facebook.com API for people, things, and the

    connections between them ▪ /me get profile information for the currently logged-in user ▪ /me/friends get a list of that person’s friends ▪ /me/music.listens get information about the music the person listens to ▪ /[place_id] get information about places where your users are Wednesday, May 29, 13
  23. Privacy & Permissions: Reading Data Wednesday, May 29, 13

  24. Privacy & Permissions: Reading Data Public Profile id, name, first_name,

    last_name, link, username, gender, locale Wednesday, May 29, 13
  25. Email Privacy & Permissions: Reading Data Public Profile id, name,

    first_name, last_name, link, username, gender, locale email Wednesday, May 29, 13
  26. Profile Properties Email Privacy & Permissions: Reading Data Public Profile

    id, name, first_name, last_name, link, username, gender, locale email user_about_me, user_activities, user_birthday, user_checkins, user_education_history, user_events, user_groups, user_hometown, user_interests, user_likes, user_location, user_notes, user_questions, user_relationships, user_relationship_details, user_religion_politics, user_status, user_subscriptions, user_videos, user_website, user_work_history, user_actions.music, user_actions.news, user_actions.video, user_games_activity, user_actions:APP_NAMESPACE Wednesday, May 29, 13
  27. Extended Profile Properties Email Privacy & Permissions: Reading Data Public

    Profile id, name, first_name, last_name, link, username, gender, locale email user_about_me, user_activities, user_birthday, user_checkins, user_education_history, user_events, user_groups, user_hometown, user_interests, user_likes, user_location, user_notes, user_questions, user_relationships, user_relationship_details, user_religion_politics, user_status, user_subscriptions, user_videos, user_website, user_work_history, user_actions.music, user_actions.news, user_actions.video, user_games_activity, user_actions:APP_NAMESPACE read_friendlists, read_insights, read_mailbox, read_requests, read_stream, xmpp_login, ads_management, create_event, manage_friendlists, manage_notifications, user_online_presence, friends_online_presence, publish_checkins, publish_actions, rsvp_event Wednesday, May 29, 13
  28. Privacy & Permissions: Trust is Key Wednesday, May 29, 13

  29. Privacy & Permissions: Trust is Key Wednesday, May 29, 13

  30. Privacy & Permissions: Trust is Key Wednesday, May 29, 13

  31. Easy publishing with the Feed Dialog Wednesday, May 29, 13

  32. Share Intent vs. Feed Dialog Wednesday, May 29, 13

  33. Share Intent vs. Feed Dialog Wednesday, May 29, 13

  34. Share Intent vs. Feed Dialog Wednesday, May 29, 13

  35. Demo Follow along: github.com/beardouglas/andevcon Wednesday, May 29, 13

  36. Deep Linking: The Way to Get Users from Facebook Wednesday,

    May 29, 13
  37. How Deep Linking Works Wednesday, May 29, 13

  38. How Deep Linking Works Users see stories generated by your

    app in their News Feed and engage with them Wednesday, May 29, 13
  39. How Deep Linking Works Users see stories generated by your

    app in their News Feed and engage with them Taken directly to app if the app is already installed Wednesday, May 29, 13
  40. How Deep Linking Works Users see stories generated by your

    app in their News Feed and engage with them Directed to Google Play to download app if it’s not installed Taken directly to app if the app is already installed Wednesday, May 29, 13
  41. Demo Wednesday, May 29, 13

  42. Uri target = getIntent().getData(); if (target != null) { //

    target will contain target_url // matching story URL } else { // launched with no deep-link Uri } Wednesday, May 29, 13
  43. Get URL from Intent data from FB Direct users to

    the correct content inside your app Uri target = getIntent().getData(); if (target != null) { // target will contain target_url // matching story URL } else { // launched with no deep-link Uri } Wednesday, May 29, 13
  44. Growing your app with Requests Wednesday, May 29, 13

  45. Wednesday, May 29, 13

  46. Wednesday, May 29, 13

  47. Wednesday, May 29, 13

  48. Wednesday, May 29, 13

  49. Demo Follow along: github.com/beardouglas/andevcon Wednesday, May 29, 13

  50. Pro Tips Wednesday, May 29, 13

  51. . Build stories worth sharing Wednesday, May 29, 13

  52. Wednesday, May 29, 13

  53. . Error-proof your sessions Wednesday, May 29, 13

  54. Session Lifecycle valid cache? new Session() CREATED_TOKEN_LOADED CREATED session.openFor…() session.open()

    OPENED success? CLOSED_LOGIN_FAILED OPENING Yes Yes No No Wednesday, May 29, 13
  55. Session Lifecycle (cont’d) session.requestNew…() session.close() OPENED success? OPENED Yes No

    CLOSED OPENED_TOKEN_UPDATED Wednesday, May 29, 13
  56. . Optimize for mobile Wednesday, May 29, 13

  57. Batching Requests Request Request Request RequestBatch public  void  setTimeout(int  timeoutInMilliseconds)

    Request Request Wednesday, May 29, 13
  58. http://a.url.can/go?here Optimize API calls Wednesday, May 29, 13

  59. http://a.url.can/go?here Optimize API calls /me?fields=photos.limit(25).fields(id,picture,tags) Wednesday, May 29, 13

  60. http://a.url.can/go?here Optimize API calls /me?fields=photos.limit(25).fields(id,picture,tags) Bundle requestParams = myPhotoRequest.getParameters(); requestParams.putString("limit",

    "25"); requestParams.putString("fields", "id,picture,tags"); myPhotoRequest.setParameters(requestParams); Wednesday, May 29, 13
  61. . Design a social data model Wednesday, May 29, 13

  62. ‣What do you need? ‣When will you need it? ‣

    How often do you expect that data to be updated? ‣What should you cache or store on your own database? ‣ Don’t use the Open Graph as a data store Social Data in your app Wednesday, May 29, 13
  63. ‣ User ‣ feed, friends, activities, interests, music, books, movies,

    television, likes, checkins, location, events ‣ Page ‣ name, category, picture. ‣ Permissions ‣ Payments ‣ Payment Subscriptions ‣ Errors https://developers.facebook.com/docs/reference/api/realtime/ Realtime Updates Wednesday, May 29, 13
  64. Realtime Updates Wednesday, May 29, 13

  65. { "object": "user", "entry": [ { "uid": 1335845740, "changed_fields": [

    "name", "picture" ], "time": 232323 }, { "uid": 1234, "changed_fields": [ "friends" ], "time": 232325 } ] } Realtime Updates Wednesday, May 29, 13
  66. . Avoid common policy violations Wednesday, May 29, 13

  67. Avoid Common Policy Pitfalls ▪ Did the user know? ▪

    Don’t pre-fill messages ▪ If you have a game that’s hosted on Facebook, be careful not to direct people off facebook.com to play the game or handle account issues ▪ Be cautious about data leaks when using external monetization and measuring toolkits ▪ Watch your spam ratings in the Insights dashboard Wednesday, May 29, 13
  68. https://graph.facebook.com/APP_ID /accounts/test-users? installed=true &name=FULL_NAME &locale=en_US &permissions=read_stream &method=post &access_token=APP_ACCESS_TOKEN { "id":

    "1234...", "access_token":"1234567..." , "login_url":"https://www.facebook.com/ platform/test_account..." "email": "example...@tfbnw.net", "password": "1234..." } Don’t look like spam: work with test users Wednesday, May 29, 13
  69. https://graph.facebook.com/ TEST_USER_1_ID/friends/ TEST_USER_2_ID ?method=post &access_token= TEST_USER_1_ACCESS_TOKEN https://graph.facebook.com/ TEST_USER_2_ID/friends/ TEST_USER_1_ID ?method=post

    &access_token= TEST_USER_2_ACCESS_TOKEN Request Confirm Create networks of test users Wednesday, May 29, 13
  70. Facebook SDK . for Android developers.facebook.com/android github.com/fbsamples/android-3.0-howtos Wednesday, May 29,

    13