Trying to create an android app with Facebook integration, I\'ve gotten to the part in the docs where you have to generate a key hash file, it specifies to run the following
At last :)
Here my story :
Add this code to your main activity, after you set layout.
try {
PackageInfo info = getPackageManager().getPackageInfo("PROJECTNAME", PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
String sign=Base64.encodeToString(md.digest(), Base64.DEFAULT);
Log.e("MY KEY HASH:", sign);
//textInstructionsOrLink = (TextView)findViewById(R.id.textstring);
//textInstructionsOrLink.setText(sign);
Toast.makeText(getApplicationContext(),sign, Toast.LENGTH_LONG).show();
}
} catch (NameNotFoundException e) {
Log.d("nope","nope");
} catch (NoSuchAlgorithmException e) {
}
Change PROJECTNAME to your package name!