facebook api, android, and you it doesn’t have to be frustrating!

9
FACEBOOK API, ANDROID, AND YOU IT DOESN’T HAVE TO BE FRUSTRATING!

Upload: barbara-alexander

Post on 22-Dec-2015

221 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: FACEBOOK API, ANDROID, AND YOU IT DOESN’T HAVE TO BE FRUSTRATING!

FACEBOOK API, ANDROID, AND YOU

IT DOESN’T HAVE TO BE FRUSTRATING!

Page 2: FACEBOOK API, ANDROID, AND YOU IT DOESN’T HAVE TO BE FRUSTRATING!

FACEBOOK QUICKSTART

https://developers.facebook.com/quickstarts/

Page 3: FACEBOOK API, ANDROID, AND YOU IT DOESN’T HAVE TO BE FRUSTRATING!

IMPORT FACEBOOK MODULE

File -> Import Module

Page 4: FACEBOOK API, ANDROID, AND YOU IT DOESN’T HAVE TO BE FRUSTRATING!

COULD NOT FIND PROPERTY 'ANDROID_BUILD_SDK_VERSION' ON PROJECT

':FACEBOOK'.

In top level folder, open gradle.properties and add:

• ANDROID_BUILD_TARGET_SDK_VERSION=21

• ANDROID_BUILD_TOOLS_VERSION=21.0.1

• ANDROID_BUILD_SDK_VERSION=21

• ANDROID_BUILD_MIN_SDK_VERSION=15

I copied my settings from the app level build.gradle

Page 5: FACEBOOK API, ANDROID, AND YOU IT DOESN’T HAVE TO BE FRUSTRATING!

ADD FACEBOOK DEPENDENCY TO MAIN APP

File -> Project Structure

Page 6: FACEBOOK API, ANDROID, AND YOU IT DOESN’T HAVE TO BE FRUSTRATING!

SHARING IN ANDROID

https://developers.facebook.com/docs/android/share#linkapi

Page 7: FACEBOOK API, ANDROID, AND YOU IT DOESN’T HAVE TO BE FRUSTRATING!

ADDING UI HELPER CODE

Follow the directions on the websiteand add the code from step one to the activity in which you want to add a button to post to Facebook.

Shortcut to Import All

Ctrl + Alt + O

Cycles through each item and lets you addit by hitting Alt + Enter.

Page 8: FACEBOOK API, ANDROID, AND YOU IT DOESN’T HAVE TO BE FRUSTRATING!

ADDING THE SHARE BUTTON

Create a button on your activity page and link it to a method with the code from step two!

Page 9: FACEBOOK API, ANDROID, AND YOU IT DOESN’T HAVE TO BE FRUSTRATING!

ADDITIONAL RESOURCES

To edit the kinds of things you want to post to Facebook, edit the ShareDialogBuilder. The page for that can be found here:

https://developers.facebook.com/docs/reference/android/current/class/FacebookDialog.ShareDialogBuilder/

Instructions on how to upload images, links, places, etc, can all be found there.

Email me at [email protected] if you have any questions!