I'm working on an Android app, in which I want to integrate a Facebook posting feature. I downloaded the Facebook-Android SDK, and I got the readme.md (text file) in there, in which it is mentioned to generate the key hash for Android. How do I generate it?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
The best approach is to use the following code:
But I was so frustrating with the fact that there is no simple tool to generate the HashKey for the Facebook app. Each time I had to play with Openssl and Keytool or to use a code to get the hash from signature ...
So I wrote a simple KeyGenTool that will do that work for you: -> KeyGenTool on Google Play <-
Enjoy :)
I have done by this way for Linux OS & Windows OS:
Linux:
keytool -exportcert -alias **myaliasname** -keystore **/home/comp-1/Desktop/mykeystore.jks** | openssl sha1 -binary | openssl base64
Kindly change Alias Name and Keystore with it's path as your requirement.
Terminal would ask for Password of Keystore. You have to provide password for the same Keystore.
So finally you would get the Release Hashkey.
Windows:
Steps for Release Hashkey:
keytool -exportcert -alias **myaliasname** -keystore **"C:\Users\hiren.patel\Desktop\mykeystore.jks"** | "C:\openssl-0.9.8e_X64\bin\openssl.exe" sha1 -binary | "C:\openssl-0.9.8e_X64\bin\openssl.exe" base64
Kindly change Alias Name and Keystore with it's path as your requirement.
Note:
Please put your details where I have marked between ** **.Terminal would ask for Password of Keystore. You have to provide password for the same Keystore.
So finally you would get the Release Hashkey.
Done
1) Create a key to sign your application, and remember the alias.
2) Install OpenSSL.
3) Put the bin folder of OpenSSL in your path.
4) Follow the steps mentioned under "Setup Single Sign-On" on the FB-Android-SDK page, and generate your Hash Key. Make sure you put the correct alias and keystore file name.
5) Create an application on Facebok, and under Mobile Devices tab, enter this Hash Key.
Official Documentation on facebook developer site:
This worked for me ...
Steps:
The simplest solution: