I am using two different methods to get the HashKey to connect an application to Facebook SDK. Although I got it connected with one of the responses I am curious to see why I am getting different results.
Working result I am generating the Key Hash within the application
public class GetHashKey extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_get_hash_key);
try {
PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md;
md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
String something = new String(Base64.encode(md.digest(), 0));
Log.e("hash key", something);
}
} catch (Exception e1) {
// TODO Auto-generated catch block
Log.e("name not found", e1.toString());
}
}
}
Other method terminal giving me the wrong result
"C:\Program Files (x86)\Java\jre7\bin\keytool" -exportcert -alias androiddebugkey -keystore "C:\Users\Eugene\.android\debug.keystore" | "C:\OpenSSL\bin\openssl" sha1 -binary | "C:\OpenSSL\bin\openssl" base64
I am assuming I am doing it incorrectly. If anyone sees a solution to get it through the terminal that would be very helpful!
No comments:
Post a Comment