Key hash for Android-Facebook app

后端 未结 30 3316
误落风尘
误落风尘 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:53

    1. Simply Open you Main Activity File and create below mention function:

           try {
          PackageInfo info = getPackageManager().getPackageInfo(
                  "your.application.package.name",
                  PackageManager.GET_SIGNATURES);
          for (Signature signature : info.signatures) {
              MessageDigest md = MessageDigest.getInstance("SHA");
              md.update(signature.toByteArray());
              Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
          }
      } catch (PackageManager.NameNotFoundException e) {
      
      } catch (NoSuchAlgorithmException e) {
       }
      

    1.1 Run you Application, this will generate a Hash key for your application.

    1. Now, Open log cat and search with "KeyHash" and copy the hash key.

    2. One you generate the Hash key you can remove this function.

提交回复
热议问题