WARNING AND NOTICE

All tricks in this blog are only for educational purpose. Learn these tricks only for your knowledge. Please donot try these to harm any one. We will not take any responsibility in any case. All softwares and tools on this site are here for private purposes only and If you want to use a software for business purpose, please purchase it. I do not host many of these tools. I Post links that I have found from numerous Search engines. I will not be responsible for any of harm you will do by using these tools.

Readmore

Friday, June 24, 2011

Using Facebook SDK in Android development, Part 1.

 Connecting to Facebook from an Android application is not as easy, as it looks. This guide will help you through some problems that you will propably encounter, with a clear and simple solution.

1. Step
First of all, download the official Facebook SDK from this site: https://github.com/facebook/facebook-android-sdk/
After that, create an application in this http://www.facebook.com/developers/ site, to get an APP ID.
2. Step
You need to create the key hash value of your signature and your android debugkeystore (for the develop stage), and than add them to your Facebook Application, in the application site. (Edit Settings -> Mobile and Devices section)
To do this, we need Openssl, download from: http://code.google.com/p/openssl-for-windows/downloads/list, and extract to a folder (in my case, c:\openssl).
To create this hash values, you need to navigate to your JAVA jdk folder, where the keytool.exe is. (In my case, in windows is: c:\Program Files(x86)\Java\jdk 1.6.0_24\bin)
Copy your debug.keystore to there from the (in my case) c:\Users\MyUserName\.android folder. In the jdk/bin folder, open a command prompt, and execute the following:
keytool -exportcert -alias androiddebugkey -keystore debug.keystore > c:\openssl\bin\debug.txt
Prompt1
(Use your openssl folder, and hit enter when asking password)
Navigate to the openssl/bin folder, and we have a debug.txt here, which contains the keystore values, but not in the expected format! Open a command promt from there, and execute the following commands:

  1. openssl sha1 -binary debug.txt > debug_sha.txt
  2. openssl base64 -in debug_sha.txt > debug_base64.txt
Prompt2
And now we are DONE! The debug_base64.txt contains the hash value, we need to copy it to the application site, in the Mobile and Devices section.
AddHash
You need to do the this hash creating flow with your signature too, to make working apk-s!
3. Step
Finally we can start coding... In the next part!

VIA : helloandroid.com