Created
November 19, 2017 15:19
-
-
Save ziginsider/742ea2b0b4441835cae244c2024af888 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
... | |
public final String TAG = this.getClass().getSimpleName(); | |
protected void onCreate(Bundle savedInstanceState) { | |
... | |
printKeyHash(); | |
} | |
private void printKeyHash() { | |
try { | |
PackageInfo info = getPackageManager() | |
.getPackageInfo("io.github.ziginsider.facebooksdkdemo", | |
PackageManager.GET_SIGNATURES); | |
for (Signature signature:info.signatures) { | |
MessageDigest md = MessageDigest.getInstance("SHA"); | |
md.update(signature.toByteArray()); | |
Log.d(TAG, "KeyHash: " + Base64.encodeToString(md.digest(),Base64.DEFAULT)); | |
} | |
} catch (PackageManager.NameNotFoundException e) { | |
e.printStackTrace(); | |
} catch (NoSuchAlgorithmException e) { | |
e.printStackTrace(); | |
} | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment