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,
For an Android application
This code is used to get the hash key in your Android application for Facebook integration. I have tested all devices and it's working. Only change the package name of this code:
private void facebookHashKey() {
try {
PackageInfo info = getPackageManager().getPackageInfo("com.app.helpcove", PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
String hashCode = Base64.encodeToString(md.digest(), Base64.DEFAULT);
System.out.println("Print the hashKey for Facebook :"+hashCode);
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
}