Log Facebook Key Hash through Java

Updated 19 April 2018

Save

In This blog, we will look into how we can get or log Facebook Key Hash through Java.

The native Facebook login integration instructions are very clear.

You can read the official docs for the same.

But when you are working on the application in the debug/ development mode, then you might have seen this error :

Invalid Key Hash. The Key xxxxxxxxxxxxxxxxxxxxxxxxxxxx does not match any of the keys ……………

Seeing this itself is annoying, but when you are not able to add/ save the key you see on your developers.facebook dashboard, that moment is frustrating.

And the most probable reason for this is that you missed some invisible character in the key hash.

Also, many times you don’t even get the right key for the debug version you just started checking on some of your devices.

I am not saying running terminal commands is bad, but using android studio is pretty simple and straightforward.

So, I have got java code for printing my key hash as a string and I just print it in my launcher activity and check if this is a new key hash or some old, if it is a new key hash I just copy and update it to developers.facebook account dashboard.

Code:

 

 

 

 

 

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home