You are on page 1of 19

10/24/13

Getting Started - Facebook Developers

Topics Facebook SDK for Android

Getting Started
Documentation › Android › Getting Started

Concepts

Features Mobile App Install Ads What's New in 3.5

The Facebook SDK for Android is the easiest way to integrate your Android app with Facebook's platform. The SDK provides support for Login with Facebook authentication, reading and writing to Facebook APIs and support for UI elements such as pickers and dialogs. This guide shows you how to get started developing with the Facebook SDK for Android. The screenshots in this guide are from an Apple OS X system, but the steps for installing on a Windows computer are almost identical. Any differences in the instructions are highlighted.

Getting Started Getting Started Getting Started with the Facebook SDK for Android (Android Studio)

1. Install the Prerequisites
Eclipse is the most popular choice for developing Android apps. 'Eclipse Classic', found on the downloads page, is sufficient for Android development. This guide assumes you are using v4.2 (Juno) or later with a default install. You also need Java v1.6 or later. Once you have Eclipse, download the Android SDK, available from the Android Developers site, and install it.

Tutorials Android SDK Tutorial 1 - Facebook Login 2 - Personalize 3 - Show Friends 4 - Show Nearby Places 5 - Publish Open Graph Story Upgrading from 2.0 to 3.0 Upgrading from 3.0.2.b to 3.0 Mobile App Install Ads Upgrading the Android SDK from 3.0 to 3.5

Also make sure you continue those instructions to install the Android Developer Tools (ADT) Plugin. You may be asked to restart Eclipse to complete the installation. You'll need to have the Android 2.2 (API 8) components installed in order to use the Facebook SDK. You should now see two new icons in your Eclipse toolbar and entries in its 'Window' menu to launch the Android SDK Manager and AVD Manager (for device emulators).

Games Tutorial Android Games Tutorial 1 - Facebook Login 2 - Personalize 3 - Invites and Requests 4 - Bragging and News Feed 5 - Publish Open Graph Story

How Tos Facebook Login Flow for Android Using the Share Dialog on Android Send Requests on Android Handle Request App Links Use the Feed Dialog App Events for Android Fetch User Data Link To Your Native App Publish to Feed Run FQL Queries Sharing and Distribution on Android Use Batch Requests Use the Object API on Android Use the native Login Dialog

Even if you have a real Android device to develop with, it is very useful to have an Android emulator configured. In the newlyinstalled 'AVD Manager', create a new AVD, and leave simple, default settings for it:

Reference Facebook SDK for Android Reference

https://developers.facebook.com/docs/android/getting-started/facebook-sdk-for-android/

1/19

we include a copy in the SDK that you can install. On a real device. https://developers. The installable APK of the Facebook app is in the b i nfolder of the SDK. a p kor similar. 5 . f a c e b o o k a n d r o i d s d k 3 . 5 . If you want to test the flow there. contains the SDK itself. To install it onto an Android emulator.x Downloads Getting Started . 2. Note the location of this folder.Facebook Developers Search Facebook Developers Docs Tools Support News Apps Log In You can now start the emulator either directly from the AVD Manager tool or do it later when you run your first Android project in Eclipse.10/24/13 Other Resources Android Change Log 3. you can test this by simply installing this app for free from Google Play.com/docs/android/getting-started/facebook-sdk-for-android/ 2/19 . The Facebook SDK uses Facebook's native app to provide support for authentication when it's present. However.facebook. it's not possible to access Google Play on an emulator. you'll first need to start the emulator. and named F B A n d r o i d 3 . The resulting folder. Install the Facebook SDK for Android and the Facebook APK Download and extract the SDK ZIP file.

it is possibly referencing an older Facebook SDK. To import the SDK library project and the samples. like this on OS X: . 5 / b i n / F B A n d r o i d 3 . add the rflag. 5 \ b i n \ F B A n d r o i d 3 . you can still develop with the Facebook SDK. rather than with the smoother app switching flow. you will have chosen this location when you unzipped the Android SDK. If you choose not to install this APK to your emulator. In this case your app's Facebook authentication will fall back to taking place via a web view. You can import these projects into a clean workspace all at once. On Windows. which is the SDK project itself. You should either delete it or change your workspace.10/24/13 Getting Started . On OS X. If one exists. with the new SDK. In particular. the SDK is installed into your home directory. go to Eclipse's 'File' > 'Import' menu. locate the a d btool in the p l a t f o r m t o o l sdirectory of your main Android SDK. you use a d bto install the APK to the running emulator in OS X like this: . and select 'General' / 'Existing Projects into Workspace': https://developers. / a d bi n s t a l l~ / f a c e b o o k a n d r o i d s d k 3 .com/docs/android/getting-started/facebook-sdk-for-android/ 3/19 .facebook. 3. check the apps screen of the emulator to check that the app has been installed correctly. Import the SDK into Eclipse The installation folder contains a directory called f a c e b o o k . make sure there is no existing f a c e b o o kproject in your workspace. a p k You should now see the Facebook app in the emulator's app list or home screen. a p k And on Windows. There is also a selection of sample projects in the s a m p l e sfolder. under A p p D a t a \ L o c a l \ A n d r o i d \ a n d r o i d s d k Assuming you've placed the Facebook SDK in your home directory. If you need to force the upgrade of this app from a previous version. 5 . / a d bi n s t a l lr~ / f a c e b o o k a n d r o i d s d k 3 . 5 . 5 / b i n / F B A n d r o i d 3 . 5 .Facebook Developers Secondly. like this: a d bi n s t a l l% H O M E P A T H % \ f a c e b o o k a n d r o i d s d k 3 . a p k Once complete.

https://developers.Facebook Developers Browse to select the root of your SDK folder.10/24/13 Getting Started .com/docs/android/getting-started/facebook-sdk-for-android/ 4/19 .facebook. f a c e b o o k a n d r o i d s d k 3 . The SDK should appear in the list as 'FacebookSDK' along with all of the samples. 5 .

However. simply make sure the project (or Eclipse) properties mandate v1.Facebook Developers You must unselect the 'Copy projects into workspace' option so that each of the sample projects retains a correct reference to the neighboring SDK. (This is useful if you expect to update the SDK in-place in the future and have your workspace's library project update accordingly.com/docs/android/getting-started/facebook-sdk-for-android/ 5/19 . However.6 in the Java Compiler section: https://developers.facebook. It is also possible that your Eclipse compiler level has not matched that required by Android. simply use 'Project' > 'Clean' in Eclipse to refresh all the project's states.10/24/13 Getting Started . If you see errors like "Android requires compiler compliance level 5. if you choose to edit the SDK samples in the future.) Click 'Finish'.".0. rather than making a copy of it. If the sample projects are showing errors.0 or 6. you may wish to subsequently re-import them with a copy so as not to affect the original versions. this means that Eclipse creates a link to the project in the SDK installation.

4. The following samples are available in the SDK: Basic samples ProfilePictureSample: demonstrates non-logged-in usage of the profile picture control FriendPickerSample: demonstrates usage of the native friend picker to choose amongst the user's friends PlacePickerSample: demonstrates logged-in usage of the place picker control Feature samples SessionLoginSample: demonstrates detailed login flow using the SDK JustRequestSample: demonstrates logged-in user making single and batched Facebook API requests SwitchUserSample: demonstrates an approach to allow switching between multiple users Complete samples HelloFacebookSample: an all-round sample that demonstrates profile access. status updates and photo uploading Scrumptious: demonstrates the use of login.10/24/13 Getting Started .Facebook Developers You are now ready to run the sample apps. You may need to provide your Android key hash to Facebook to run some of the samples. pickers. The samples should be visible in your workspace following the import in the previous step. You can learn how to do this in the next step. and Open Graph publishing RPS : demonstrates the use of the Native Share Dialog. https://developers.facebook. invites. and deep linking. and each should correctly reference the neighboring 'FacebookSDK' library project. picture uploads.com/docs/android/getting-started/facebook-sdk-for-android/ 6/19 . pickers. Run the Samples Each of the samples demonstrates an important part of the SDK and techniques for building social apps. Open Graph publishing. requests.

facebook.Facebook Developers Select a sample project and press 'Run' in Eclipse. https://developers. displaying the sample you've chosen. you may be prompted to indicate how to do so: Select 'Android Application'.com/docs/android/getting-started/facebook-sdk-for-android/ 7/19 .10/24/13 Getting Started . and your Android emulator should start. When you first try to do so.

a n d r o i ddirectory). k e y s t o r eis present. a n d r o i d / d e b u g . such as ProfilePictureSample. using the dropdown menu in the top-right. If you want to run those that involve authentication. you will be required to quickly register as a developer. Put simply. Make sure you are logged into Facebook and. however. in your home . This is. On OS X.as we'll see later. and you will need to register each app's key hash with Facebook as a security check for authenticity . k e y s t o r e|o p e n s s ls h a 1b i n a r y You will be prompted for a password. every Android app you'll create will be signed. use: k e y t o o le x p o r t c e r ta l i a sa n d r o i d d e b u g k e yk e y s t o r e% H O M E P A T H % \ . to generate your key hash on your local computer. But to bypass this check for the SDK samples and to get them up and running quickly.Facebook Developers The very simplest apps.facebook. This should be 'android' without quotes. If you haven't done so yet.com/docs/android/getting-started/facebook-sdk-for-android/ 8/19 . k e y s t o r e|o p e n s s ls h a 1b i n a r y|o p e n s s lb a s e 6 On Windows.10/24/13 Getting Started . by default. go to your 'Settings': Then. a n d r o i d \ d e b u g . go to the 'Developer Settings' section on the left. (If you are not prompted for a password.) Finally go to the Facebook Developer site. run Java's k e y t o o lutility (which should be on your console's path) against the Android debug keystore. you can add your key hash to your global Facebook Developer profile. https://developers. run: k e y t o o le x p o r t c e r ta l i a sa n d r o i d d e b u g k e yk e y s t o r e~ / . which is to provide your Android key hash to Facebook. Firstly. will run immediately. something is wrong and you must check your paths above to ensure the d e b u g . You'll then be given a key hash of 30 characters or so. you will need to perform one extra step of configuration.

one of the following scenarios will occur: A native Login Dialog is displayed but after accepting the permissions you are still in a logged out state. it may be related to the key hash.10/24/13 Getting Started . here is another option that ensures you're using the correct key hash. Troubleshooting If you have a problem running the sample app... It involves changing code in one of the sample apps to print the signature sent to Facebook. If this is the case. You'll modify the 'HelloFacebookSample' sample.App is Misconfigured for facebook login. p r o t o c o l . https://developers.) You will now be able to compile and run all of the authentication-based samples on your emulator without issue..Facebook Developers You'll then be able to add and save your key hash into your profile: (Note that you can add multiple key hashes here if you are developing with multiple machines. The logcat also contains an exception similar to this: 1 2 2 01 0 : 2 3 : 2 4 . f a c e b o o k . A p i E x c e p t i o n :r e m o t e _ a p p _ i A non-native Login Dialog is displayed that includes an error message at the top: ''.facebook.com/docs/android/getting-started/facebook-sdk-for-android/ 9/19 . Besides double checking your key hash generation steps. o r c a . b a s e . 5 0 7 :W / f b 4 a : f b : O r c a S e r v i c e Q u e u e ( 5 0 4 ) :c o m .''.

L o g . f a c e b o o k . You'll need to add this to your project files.B a s e 6 4 . / /A d dc o d et op r i n to u tt h ek e yh a s h t r y{ P a c k a g e I n f oi n f o=g e t P a c k a g e M a n a g e r ( ) . h e l l o f a c e b o o k " . d i g e s t ( ) . Therefore. By default.facebook. use the 'keytool' in the https://developers. g e t I n s t a n c e ( " S H A " ) . . The key hash is used by Facebook as a security check for authenticity. In either case.B a s e 6 4 . D E F A U L T ) ) . Add the debug key hash that you obtained at the end of the previous step with the k e y t o o lapp. G E T _ S I G N A T U R E S ) . o n C r e a t e ( s a v e d I n s t a n c e S t a t e ) . f o r( S i g n a t u r es i g n a t u r e:i n f o . P a c k a g e M a n a g e r . m d . you want to make sure you have the hashes of all the related keys set on Facebook: Click 'Edit App' and open up the 'Native Android App' section at the bottom of the dashboard. g e t P a c k a g e I n f o ( " c o m . s i g n a t u r e s ){ M e s s a g e D i g e s tm d=M e s s a g e D i g e s t . Click 'Create New App'. 5. the app's package is signed with a machine specific debug key.Facebook Developers Open up the H e l l o F a c e b o o k S a m p l e A c t i v i t yclass and make the following temporary change to the o n C r e a t e ( )method: @ O v e r r i d e p u b l i cv o i do n C r e a t e ( B u n d l es a v e d I n s t a n c e S t a t e ){ s u p e r . 7 4 7 :D / K e y H a s h : ( 9 3 6 ) :4 7 8 u E n K Q V + f M Q T 8 D y 4 A K v H k Y i b o = Save the printed key hash in your developer profile. t o B y t e A r r a y ( ) ) . note down the app ID shown at the top of the dashboard page. of course. Save your changes and re-run the sample. and enter basic information such as its name and a unique namespace. If you have a release key. } }c a t c h( N a m e N o t F o u n d E x c e p t i o ne ){ }c a t c h( N o S u c h A l g o r i t h m E x c e p t i o ne ){ } . u p d a t e ( s i g n a t u r e . Once created. you will need to add its hash in the same way.com/docs/android/getting-started/facebook-sdk-for-android/ 10/19 . s a m p l e s . When publishing the app it is typically signed with a different. Check your logcat output for a message similar to this: 1 2 2 01 0 : 4 7 : 3 7 .10/24/13 Getting Started . Re-run the samples once more and verify that you can log in successfully. d ( " K e y H a s h : " . To obtain the release key hash. you will also need to associate your Android keys hashes with the app. you can. Create a Facebook App Return to the App Dashboard on the Facebook Developers site. e n c o d e T o S t r i n g ( m d . release key. use the ID of an existing app. . Alternatively.

Create a new Android Project with Facebook Login In this final step. You will also need to return to this dashboard and add your app's package name and main activity class once you have created a new Android project itself. but we https://developers. using 'File' > 'New' > 'Project. Create a new Android project Create a new Android Application Project in Eclipse. run: k e y t o o le x p o r t c e r ta l i a s< R E L E A S E _ K E Y _ A L I A S >k e y s t o r e< R E L E A S E _ K E Y _ P A T H >|o p e n s s ls h a 1b i n a r y|o p e n s s lb a s e 6 4 On Windows.. Save this change. 6. use: k e y t o o le x p o r t c e r ta l i a s< R E L E A S E _ K E Y _ A L I A S >k e y s t o r e< R E L E A S E _ K E Y _ P A T H >|o p e n s s ls h a 1b i n a r y|o p e n s s lb a s e 6 4 Make sure to use the password that you set when you first created the release key..facebook. we will create a new project and add the minimum code required to demonstrate Facebook login.com/docs/android/getting-started/facebook-sdk-for-android/ 11/19 .Facebook Developers same way as in the steps above except for the alias and path.' and select 'Android Application Project': You are not obliged to use the same app name and namespace as you did when you registered the app with Facebook. On OS X.10/24/13 Getting Started .

we can create the main activity for the app. provide a name for the activity. For this example. we have a very basic user-interface. https://developers.Facebook Developers have here. You can leave this as the default M a i n A c t i v i t ywith a layout name of a c t i v i t y _ m a i n . You can then quickly choose an icon for your app: Next.10/24/13 Getting Started .com/docs/android/getting-started/facebook-sdk-for-android/ 12/19 . and can simply choose a 'BlankActivity': Finally.facebook. for consistency.

and your new project will have been created.com/docs/android/getting-started/facebook-sdk-for-android/ 13/19 . click 'Add' and choose the 'FacebookSDK' project from the workspace: https://developers. along with the main activity class: Register the package and activity with Facebook At this point. and navigate to the 'Android' tab.facebook. your new application needs to be linked to the SDK library project.10/24/13 Getting Started . Also enable 'Facebook Login': Link to the SDK project and configure the Facebook app ID Returning to Eclipse. In the lower part of the dialog. you should return to the App Dashboard on the Facebook Developers site and add your Android app's package and activity names to the Android settings.Facebook Developers Finish the wizard. View the properties for the project.

com/docs/android/getting-started/facebook-sdk-for-android/ 14/19 . x m lfile in the r e s / v a l u e sfolder of your project. (If you view the source of the s t r i n g s .Facebook Developers To add the Facebook app ID into your project.facebook. x m lfile. you will see the resulting < s t r i n g n a m e = " a p p _ i d " > 4 9 7 9 0 6 9 5 3 5 6 6 7 5 7 < / s t r i n g >in the document.) https://developers. open up the s t r i n g s . You need to add an a p p _ i dstring containing the ID you obtained in the previous step.10/24/13 Getting Started .

p e r m i s s i o n . add a 'Meta Data' item called c o m . Add a 'Uses Permission' item named a n d r o i d . open the A n d r o i d M a n i f e s t .com/docs/android/getting-started/facebook-sdk-for-android/ 15/19 . x m lfile in the root of the project.Facebook Developers Next.10/24/13 Getting Started . f a c e b o o k .facebook. in the 'Application' tab. with the name c o m . f a c e b o o k . A p p l i c a t i o n I d . s d k . add a new Activity to the app. I N T E R N E T : Also. with a value of the a p p _ i dstring you just configured: Finally. L o g i n A c t i v i t y https://developers.

f a c e b o o k . https://developers. a simple user-interface layout was created. as shown below: If you view the source for the layout. you should see something like . < u s e s p e r m i s s i o n a n d r o i d : n a m e = " a n d r o i d . if you check the source of the file. f a c e b o o k . I N T E R N E T " / > . and < a c t i v i t ya n d r o i d : n a m e = " c o m .< m e t a d a t aa n d r o i d : n a m e = " c o m . called a c t i v i t y _ m a i n . L o g i n A c t i v i t y " / > ) A minimum viable social application When we initially created this project.facebook.Facebook Developers (Again. x m land in the r e s / l a y o u tfolder of your project. you should see the three corresponding new lines in the XML. select the text label in the middle of the screen of the designer. . A p p l i c a t i o n I d " a n d r o i d : v a l u e = " @ s t r i n g / a p p _ i d " / > . . and give it an ID of @ + i d / w e l c o m e .10/24/13 Getting Started . Open this. p e r m i s s i o n .com/docs/android/getting-started/facebook-sdk-for-android/ 16/19 . s d k .

o n C r e a t e ( s a v e d I n s t a n c e S t a t e ) . including the static e x e c u t e M e R e q u e s t A s y n c . * . o n A c t i v i t y R e s u l t ( r e q u e s t C o d e .10/24/13 Getting Started . f a c e b o o k . This takes three arguments: a reference to this Activity. .com/docs/android/getting-started/facebook-sdk-for-android/ 17/19 . and finally a callback for when the status changes. for example). g e t A c t i v e S e s s i o n ( ) .d a t a ) . i s O p e n e d ( ) ){ } Inside this. o p e n A c t i v e S e s s i o n ( t h i s . we can keep it anonymous). Since the login flow for your app will require the users to transition out of.r e s u l t C o d e . you will want to benefit from caching tokens.facebook. The first thing we should do is add a couple of i m p o r t s to the top of the class file for the Facebook SDK (and the model package which includes a number of strongly-typed social graph objects): i m p o r tc o m . T e x t V i e w . s e t C o n t e n t V i e w ( R . and described in the Facebook Login guide. . For example. Inside the c a l lmethod. i m p o r ta n d r o i d . in turn. this Activity. o n A c t i v i t y R e s u l t ( t h i s . resuming sessions and the like. G r a p h U s e r C a l l b a c k ( ){ / /c a l l b a c ka f t e rG r a p hA P Ir e s p o n s ew i t hu s e ro b j e c t https://developers.t r u e . You will also need the following Android packages.S e s s i o n S t a t es t a t e . S e s s i o n . c o n t e n t . To do so. w i d g e t . f a c e b o o k . S t a t u s C a l l b a c k ( ){ / /c a l l b a c kw h e ns e s s i o nc h a n g e ss t a t e @ O v e r r i d e p u b l i cv o i dc a l l ( S e s s i o ns e s s i o n . The R e q u e s tclass provides a number of convenience methods for creating and executing common calls like this. j a v afile in the project's s r cfolder. (A more robust implementation might need to create this callback as a named instance. check that the session is open: i f( s e s s i o n .r e s u l t C o d e . l a y o u t . and back into.n e wS e s s i o n . * .E x c e p t i o ne x c e p t i o n ){ } } ) . m o d e l . but for this simple example. } The c a l lmethod of the callback will likely fire multiple times (when the session is O P E N I N Gand then O P E N E D .r e q u e s t C o d e . we need a small amount of wiring to update the active session: @ O v e r r i d e p u b l i cv o i do n A c t i v i t y R e s u l t ( i n tr e q u e s t C o d e .Facebook Developers < T e x t V i e w a n d r o i d : i d = " @ + i d / w e l c o m e " a n d r o i d : l a y o u t _ w i d t h = " w r a p _ c o n t e n t " .) At the end of the o n C r e a t emethod. the first of which allows us to work with the text field we created an i dfor earlier: i m p o r ta n d r o i d . With this reference. add S e s s i o n . e x e c u t e M e R e q u e s t A s y n c ( s e s s i o n .n e wR e q u e s t . o p e n A c t i v e S e s s i o n ( )to initiate the Facebook Login. @ O v e r r i d e p u b l i cv o i do n C r e a t e ( B u n d l es a v e d I n s t a n c e S t a t e ){ s u p e r . / /s t a r tF a c e b o o kL o g i n S e s s i o n . another callback (strongly-typed for the user data that will be returned) which will contain your code for when the API call completes: / /m a k er e q u e s tt ot h e/ m eA P I R e q u e s t . and. a c t i v i t y _ m a i n ) . i m p o r tc o m . } (More comprehensive implementations of the Session and Activity life cycles are used in the sample apps. An important part of the Facebook SDK is the S e s s i o nclass which manages much of the process of authenticating and authorizing users.I n t e n td a t a ){ s u p e r . we will be able to update the welcome to include the user's name when they log in with Facebook. I n t e n t .d a t a ) . We want to use that final successful state to fetch the user's name and update the welcome message. This takes a reference to the session. we finally open the M a i n A c t i v i t y . a flag to indicate that the Login UI should be used.i n tr e s u l t C o d e . we can make a request to the / m eendpoint of the Facebook Graph API to fetch the user's basic information.

R e s p o n s er e s p o n s e ){ } } ) . j a v ais as follows: p a c k a g ec o m . w i d g e t . w e l c o m e ) .E x c e p t i o ne x c e p t i o n ){ i f( s e s s i o n .com/docs/android/getting-started/facebook-sdk-for-android/ 18/19 . I n t e n t .Facebook Developers @ O v e r r i d e p u b l i cv o i do n C o m p l e t e d ( G r a p h U s e ru s e r . * . we simply replace the TextView label (which we gave the ' w e l c o m e ' ID to. Inside this o n C o m p l e t e dmethod. f a c e b o o k . i s O p e n e d ( ) ){ / /m a k er e q u e s tt ot h e/ m eA P I https://developers. f i r s t a n d r o i d a p p . o n C r e a t e ( s a v e d I n s t a n c e S t a t e ) .S e s s i o n S t a t es t a t e . or via a modal web view dialog if not). w e l c o m e . B u n d l e . i m p o r ta n d r o i d . and and on successful login. S t a t u s C a l l b a c k ( ){ / /c a l l b a c kw h e ns e s s i o nc h a n g e ss t a t e @ O v e r r i d e p u b l i cv o i dc a l l ( S e s s i o ns e s s i o n . i d . p u b l i cc l a s sM a i n A c t i v i t ye x t e n d sA c t i v i t y{ @ O v e r r i d e p u b l i cv o i do n C r e a t e ( B u n d l es a v e d I n s t a n c e S t a t e ){ s u p e r . will display the user's name: Congratulations! You have built your first social Android app and are ready to deep dive and further explore the Facebook SDK. l a y o u t . s e t C o n t e n t V i e w ( R . the application will immediately initiate the Facebook Login flow (which will either be via the Facebook app if you installed the APK on the emulator. f a c e b o o k .facebook. i m p o r ta n d r o i d . i m p o r ta n d r o i d . i m p o r tc o m . i m p o r ta n d r o i d . m o d e l .t r u e . On launch. * . o p e n A c t i v e S e s s i o n ( t h i s . To conclude. a p p . earlier) with the user's name: i f( u s e r! =n u l l ){ T e x t V i e ww e l c o m e=( T e x t V i e w )f i n d V i e w B y I d ( R .n e wS e s s i o n . g e t N a m e ( )+" ! " ) .10/24/13 Getting Started . } Save all your files. s e t T e x t ( " H e l l o"+u s e r . T e x t V i e w . our completed code for M a i n A c t i v i t y . a c t i v i t y _ m a i n ) . and run. A c t i v i t y . c o n t e n t . i m p o r tc o m . o s . / /s t a r tF a c e b o o kL o g i n S e s s i o n .

com/docs/android/getting-started/facebook-sdk-for-android/ 19/19 . G r a p h U s e r C a l l b a c k ( ){ / /c a l l b a c ka f t e rG r a p hA P Ir e s p o n s ew i t hu s e ro b j e c t @ O v e r r i d e p u b l i cv o i do n C o m p l e t e d ( G r a p h U s e ru s e r . w e l c o m e . o n A c t i v i t y R e s u l t ( r e q u e s t C o d e .10/24/13 Getting Started . o n A c t i v i t y R e s u l t ( t h i s . next check out and enhance our sample apps by following the Scrumptious Tutorial. That's it with the Getting Started Guide. Like Send 247 people like this.I n t e n td a t a ){ s u p e r . Updated last Friday Facebook © 2013 · English (US) About Advertising Careers Platform Policies Privacy Policy https://developers. } } Please note: If you are using ProGuard on the release build of your app..i n tr e s u l t C o d e . s e t T e x t ( " H e l l o"+u s e r . you must add this snippet to your app's proguard-project. g e t N a m e ( )+" ! " ) . } @ O v e r r i d e p u b l i cv o i do n A c t i v i t y R e s u l t ( i n tr e q u e s t C o d e .} k e e p a t t r i b u t e sS i g n a t u r e These flags are used to preserve generics signatures and to preserve type information used for reflection.n e wR e q u e s t .txt config file: k e e pc l a s sc o m . * *{* .d a t a ) .facebook.R e s p o n s er e s p o n s e ){ i f( u s e r! =n u l l ){ T e x t V i e ww e l c o m e=( T e x t V i e w )f i n d V i e w B y I d ( R .r e s u l t C o d e . w e l c o m e ) ..Facebook Developers R e q u e s t . f a c e b o o k . S e s s i o n . } } } ) .r e q u e s t C o d e . g e t A c t i v e S e s s i o n ( ) . Both flags are necessary for the SDK to function correctly in an Android app. i d .r e s u l t C o d e . e x e c u t e M e R e q u e s t A s y n c ( s e s s i o n . } } } ) .d a t a ) .