Last active
June 2, 2017 19:56
-
-
Save alexshr/a1703a28c5742b5a1996deeab0bf2ad3 to your computer and use it in GitHub Desktop.
Call it in Activity.onCreate to see facebook debug key hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Call it in Activity.onCreate to see facebook debug key hash | |
* | |
* @param activity | |
*/ | |
public static void logFbKeyHash(Activity activity) { | |
try { | |
PackageInfo info = activity.getPackageManager().getPackageInfo( | |
activity.getPackageName(), | |
PackageManager.GET_SIGNATURES); | |
for (Signature signature : info.signatures) { | |
MessageDigest md = MessageDigest.getInstance("SHA"); | |
md.update(signature.toByteArray()); | |
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT)); | |
} | |
} catch (Exception e) { | |
Log.e("logFbKeyHash", "", e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment