I tried to use Facebook login in my app. But I have this problem only on my physical android device. (not a virtual device)
How can I fix it?
I tried to use Facebook login in my app. But I have this problem only on my physical android device. (not a virtual device)
How can I fix it?
You need to setup the key hash in the facebook App Dashboard. To get the signature key hash, just call the method below in your App in a release build (no publishing required) and run your app - in Logcat you can see the output. After this you can remove the method. If you want it also to work for debugging purposes do the same in a debug release. Because the hashes are different.
private void printKeyHash() {
try {
PackageInfo info = getPackageManager().getPackageInfo(getPackageName() , PackageManager.GET_SIGNATURES);
for(Signature signature:info.signatures){
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.i("Signature", Base64.encodeToString(md.digest(), Base64.DEFAULT));// <--- signature
}
} catch(Exception e) {
e.printStackTrace();
}
}
In Facebook App Dashboard enter the hashes. And don't forget to switch the App Mode to live after your app is released