infinum android talks #14 - facebook for android api

34
We design and develop great software for mobile and web.

Upload: infinum

Post on 08-Apr-2017

35 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Infinum Android Talks #14 - Facebook for Android API

We design and develop great software for mobile and web.

Page 2: Infinum Android Talks #14 - Facebook for Android API

Facebook for Android API

Android talks #6 Željko Plesac

Page 3: Infinum Android Talks #14 - Facebook for Android API

Scope• Introduction

• Prerequisites

• Common Facebook API actions

• Graph API, custom stories, Facebook Insights

• Conclusion

Page 4: Infinum Android Talks #14 - Facebook for Android API

1. Introduction

• Facebook is the world’s largest social network, with more than 1 000 000 000 users

Page 5: Infinum Android Talks #14 - Facebook for Android API

1. Introduction

• Facebook is the world’s largest social network, with more than 1 000 000 000 users

Facebook is the world’s largest repository of personal information!

Page 6: Infinum Android Talks #14 - Facebook for Android API

Why use Facebook?• obtain information about users

• use it as authentication system

• export information from our applications to Facebook

• attract new users

Page 7: Infinum Android Talks #14 - Facebook for Android API

Why use Facebook?• obtain information about users

• use it as authentication system

• export information from our applications to Facebook

• attract new users

Everybody and everything !is on Facebook!

Page 8: Infinum Android Talks #14 - Facebook for Android API

Prerequisites

• Facebook account

• Facebook for Android SDK - current version is 3.15.0 (officially not on Maven)

• applications have to be registered on Facebook (http://developers.facebook.com) and we need to provide some basic info

Page 9: Infinum Android Talks #14 - Facebook for Android API

Common Facebook actions

• 1. Facebook login

• 2. Post to wall

• 3. Read user data

Page 10: Infinum Android Talks #14 - Facebook for Android API

Facebook Login

• Applications must implement Facebook Login

• OAuth 2.0.

• session management

• obtain default permissions

Page 11: Infinum Android Talks #14 - Facebook for Android API

Permissions???

Page 12: Infinum Android Talks #14 - Facebook for Android API

Permissions• due to the personal nature of user informations,

Facebook has developed complex schema for accessing personal data

• informations are categorised; in order to access them, you need to obtain permissions from their owners (users)

• permissions can be requested at any time

• by default, with login you obtain 3 permissions: email, public_profile, user_friends

Page 13: Infinum Android Talks #14 - Facebook for Android API
Page 14: Infinum Android Talks #14 - Facebook for Android API

Post to wall

• we want to export informations from our application to users Facebook wall (write comment, upload pictures, share links…)

Page 15: Infinum Android Talks #14 - Facebook for Android API

This should be easy…

Page 16: Infinum Android Talks #14 - Facebook for Android API

Post to wall

• 3 cases

• with Facebook native application

• with WebDialog

• with background request by using Graph API

Page 17: Infinum Android Talks #14 - Facebook for Android API

Post to wall - case 1.• only possible if user has installed Facebook for

Android application

• check:

Page 18: Infinum Android Talks #14 - Facebook for Android API

Post to wall - case 1.

• 2 dialogs: ShareDialog and PhotoShareDialog

• no additional permissions are needed

• user has to manually confirm publish action

Page 19: Infinum Android Talks #14 - Facebook for Android API

Post to wall - case 2.

• If Facebook for Android application is not present on mobile device, we can use WebDialog

• no additional permissions are needed

• user has to manually confirm publish action

Page 20: Infinum Android Talks #14 - Facebook for Android API

Post to wall - case 3.

• Applications can post automatically to users wall by using Graph API requests (not visible to user)

• in order to use this feature, app has to be submitted for Facebook review

Page 21: Infinum Android Talks #14 - Facebook for Android API

Facebook review???

Page 22: Infinum Android Talks #14 - Facebook for Android API

Facebook review• In order to use advanced features of Facebook, like

background write to wall, custom stories, etc… applications have to be submitted for Facebook review

• Applications have to comply with Facebook Terms

• All platforms are submitted to review

• Every feature has to be reviewed

Page 23: Infinum Android Talks #14 - Facebook for Android API

• Upload photos - users must take these photos with an actual camera. All photos must be original

• Tags - all tags must be manually added by user

• User messages - users must personally write these messages. Even if users can control (edit or delete) the message content, applications cannot pre-fill user messages

• Applications must use the latest versions of SDK

• Applications must implement Facebook login

Example of terms

Page 24: Infinum Android Talks #14 - Facebook for Android API

Review survival cheat sheet• all banners, icons and screenshots have to be in exact dimensions

• banners need to contain app name

• check for grammar errors

• provide real app data

• remove all unnecessary restrictions from your app

• don’t cheat - Facebook could disable your account and blacklist your application

Page 25: Infinum Android Talks #14 - Facebook for Android API

Graph API• primary way for apps to read and write to the Facebook social graph

• social graph a representation of the information on Facebook composed of:

• nodes (basically "things" such as a User, a Photo, a Page, a Comment)

• edges (the connections between those "things", such as a Page's Photos, or a Photo's Comments)

• fields (info about those "things", such as the birthday of a User, or the name of a Page).

• HTTP based

• be sure to ask users for permissions!

Page 26: Infinum Android Talks #14 - Facebook for Android API

OpenGraph stories• People use stories

to share the things they're doing, the people they're doing them with and the places where they happen.

Page 27: Infinum Android Talks #14 - Facebook for Android API

Graph stories• Every story has 4 elements:

• Actor - person who published the story(i.e. Brie Taylor)

• App - app that publishes the story on the actor’s behalf (i.e. “Goodreads”)

• Action - activity the actor performs (i.e. “finished reading”)

• object - object the actor interacts with (i.e. book “Ask the Dusk”)

Page 28: Infinum Android Talks #14 - Facebook for Android API

Common actions• Set of predefined actions, i.e.

• read a book

• listen to music

• watched the video

• they don’t need to be created, you can just start publishing them

• more at https://developers.facebook.com/docs/reference/opengraph/

Page 29: Infinum Android Talks #14 - Facebook for Android API

Custom stories

• Open graph stories created solely for our application

• have to comply with Facebook terms

• must be reviewed on test user before they can be used in production

Page 30: Infinum Android Talks #14 - Facebook for Android API

Custom stories

Page 31: Infinum Android Talks #14 - Facebook for Android API

Custom story code snippet

Page 32: Infinum Android Talks #14 - Facebook for Android API

Facebook Insights

• for collecting analytics

• data are collected anonymously

• can be shared with other Facebook users

Page 33: Infinum Android Talks #14 - Facebook for Android API

Facebook Insights - example

Page 34: Infinum Android Talks #14 - Facebook for Android API

Conclusion

• Facebook can greatly increase user experience of your application

• it’s not something that will be implemented in 15 minutes

• integrate Facebook at the beginning of development process due to various reviews