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. 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
  3. The Facebook SDK for Android Native UI Graph Core LoginButton

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

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

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

    getActivity(), callback); uiHelper.onCreate(savedInstanceState); } Wednesday, May 29, 13
  7. 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
  8. Privacy & Permissions: Reading Data Public Profile id, name, first_name,

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

    first_name, last_name, link, username, gender, locale email Wednesday, May 29, 13
  10. 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
  11. 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
  12. How Deep Linking Works Users see stories generated by your

    app in their News Feed and engage with them Wednesday, May 29, 13
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. ‣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
  20. ‣ 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
  21. { "object": "user", "entry": [ { "uid": 1335845740, "changed_fields": [

    "name", "picture" ], "time": 232323 }, { "uid": 1234, "changed_fields": [ "friends" ], "time": 232325 } ] } Realtime Updates Wednesday, May 29, 13
  22. 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
  23. 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": "[email protected]", "password": "1234..." } Don’t look like spam: work with test users Wednesday, May 29, 13