Facebook Android Generate Key Hash

后端 未结 21 2352
误落风尘
误落风尘 2020-11-22 04:11

Trying to create an android app with Facebook integration, I\'ve gotten to the part in the docs where you have to generate a key hash file, it specifies to run the following

21条回答
  •  天涯浪人
    2020-11-22 05:09

    use this in kotlin for print key hash in log

    try {
            val info = context.getPackageManager().getPackageInfo(context.packageName,
                    PackageManager.GET_SIGNATURES);
            for (signature in info.signatures) {
                val md = MessageDigest.getInstance("SHA")
                md.update(signature.toByteArray())
                Log.d("Key hash ", android.util.Base64.encodeToString(md.digest(), android.util.Base64.DEFAULT))
            }
        }catch (e:Exception){
    
        }
    

提交回复
热议问题