Download presentation
Presentation is loading. Please wait.
Published byJonah Clarke Modified over 9 years ago
1
PARSING FACEBOOK DATA FOR ANDROID 1
2
Step by Step Import Android SDK Get the hash key Create a new app Create a new project in Eclipse Setting android layout File Class in Package Folder Edit AndoidManifest.xml Run your app! 2
3
Import Android SDK Download Android SDK from https://developers.facebook.com/docs/android https://developers.facebook.com/docs/android Import SDK to your workspace 3
4
Get the Hash Key Download and extract OpenSSL from https://code.google.com/p/openssl-for- windows/downloads/detail?name=openssl-0.9.8k_WIN32.zip https://code.google.com/p/openssl-for- windows/downloads/detail?name=openssl-0.9.8k_WIN32.zip Get the path location of OpenSSL/bin Get the path location of debug.keystore from android folder C:\Users\User\.android 4
5
Get the Hash Key (cont.) Open cmd Change root in command line with path location of Java jre. example : Write this command Example : keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl base64 keytool -exportcert -alias androiddebugkey -keystore “C:\Users\User\.android\debug.keystore”| “C:\OpenSSL\bin\openssl” sha1 -binary | “C:\OpenSSL\bin\openssl” base64 5 Path debug.keystore Path openssl.exe
6
Get the Hash Key (cont.) Will appear hash key in command line. Save the hash key. 6 Hash key
7
Create a facebook app Open link facebook developer. Create a New App. 7
8
Create a facebook app (cont.) Save App ID. We will use the ID in androidmanifest.xml (setting for android) 8
9
Create a facebook app (cont.) Go to 'Settings' in the left navigation, then click on the 'Add Platform' button, and select Android. Add the debug hash key from previous step. Change button Single Sign On to “Yes” 9
10
Create New Project in Eclipse When you create new android application, dont’ forget to use package name that you have written when create a facebook app (previous step) Minimum android SDK for facebook API 10
11
Create New Project in Eclipse (cont.) Right click at the project, then choose Properties Go to ‘Android’ in the left nav and add facebook SDK library 11
12
Create New Project in Eclipse (cont.) Add tag string app_id from previous step to res/values/string.xml 12
13
Create New Project in Eclipse (cont.) Copy all file above to your libs folder. We use Parse library from www.parse.com to easier access facebook datawww.parse.com 13
14
Setting android layout Open /res/layout/main.xml. Edit the code 14 Graphical layout main.xml
15
Setting android layout (cont.) Make new userdetails.xml file in res/layout 15 Graphical layout userdetails.xml
16
Setting android layout (cont.) 16
17
Setting android layout (cont.) 17
18
File Class in Package Folder Add new LoginActivity class (you can copy the code but dont forget to change package name in first line of the code) This activity will call the facebook login and ask permission from the user. This activity also call parse libraries to parsing data user with JSON. You can setting the data you will access in list permission. For more information facebook data that allowed to access can you see in https://developers.facebook.com/docs/graph- api/reference/userhttps://developers.facebook.com/docs/graph- api/reference/user 18
19
File Class in Package Folder (cont.) Add new UserDetailsActivity.java class (you can copy the code but dont forget to change package name in first line of the code) This class is to show result of parsing data. Add new IntegratingFacebookTutorialApplication.java class (you can copy the code but dont forget to change package name in first line of the code) This class will connect Parse Library to your class. 19
20
Edit AndoidManifest.xml This application need to connect with internet. So you need to add some permission tag The activity must initialize in tag application and add meta-data tag 20
21
Run the application Now, your application ready to run ! 21
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.