vendredi 27 mars 2015

Hash key release in Android for Facebook

I am trying to get the hash for the realese application with this code on the Splash class



try {
PackageInfo info = getPackageManager().getPackageInfo("com.myapp", PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.i("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (PackageManager.NameNotFoundException e) {

} catch (NoSuchAlgorithmException e) {

}


The problem is that getPackageManager().getPackageInfo("com.myapp", PackageManager.GET_SIGNATURES) throws an error that can't find the package.


The package name is the same that is in the AndroidManifest.xml


Thank you


Aucun commentaire:

Enregistrer un commentaire