2017年6月20日 星期二

android API


1.       Download the facebook android API (actually it is a project)


2.       Unzip it at workspace

3.       Create a new project for the Facebook SDK in your Eclipse workspace.

4.       Select File -> New -> Project, choose Android Project (inside the Android folder), and then click Next.
5.       Select "Create project from existing source".
6.       Select the facebook subdirectory from within the git repository. You should see the project properties populated (you might want to change the project name to something like "FacebookSDK").
7.       Click Finish to continue.
8.       The Facebook SDK is now configured and ready to go.
9.       Right click sklee7_LBS Select  Properties. Open the Android section within the Properties dialog.
In the bottom Library section, click Add... and select the Facebook SDK project. (facebookapi)
10.   Register your application with Facebook:
Create a new Facebook application: http://www.facebook.com/developers/createapp.php . If you already have a canvas or web application, you can use the same application ID.
Set your application's name and picture. This is what users will see when they authorize your application.

11.   Get the key hash
"C:\Program Files\Java\jre6\bin\keytool" -exportcert -alias androiddebugkey -storepass android -keystore "C:\Users\Edgar\.android\debug.keystore| "C:\Program Files\GnuWin32\bin\openssl" sha1 -binary| C:\Program Files\GnuWin32\bin\openssl" enc -a -e
The format means
keytool -exportcert -alias [alias] -keystore [keystore]
| openssl sha1 -binary
| openssl enc -a -e

12.   In the Facebook developer settings, go to the Mobile and Devices tab.
In the Android section, enter the key hash in the Key Hash field.
13.   in Example.java
Find APP_ID replace the value -  public static final String APP_ID = "177078025637529";
177078025637529 is my application

the api should working now
I am terribly sorry about this, since I install this api in trial and error base.
So I am not sure am I missing some ticky part.
Please contact me if there's any problem on my program.

Thank you very much