Key hash for Android-Facebook app

后端 未结 30 2721
误落风尘
误落风尘 2020-11-22 01:17

I\'m working on an Android app, in which I want to integrate a Facebook posting feature. I downloaded the Facebook-Android SDK, and I got the readme.md (text file) in there,

30条回答
  •  难免孤独
    2020-11-22 01:59

    Use this for print key hash in kotlin

    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){
    
        }
    

提交回复
热议问题