songining

์•ˆ๋“œ๋กœ์ด๋“œ ์•ฑ์— ์นด์นด์˜ค ๋กœ๊ทธ์ธ ์—ฐ๋™์„ ํ•˜๊ธฐ์œ„ํ•ด ํ•ด์‹œํ‚ค ๊ตฌํ•˜๋Š” ๋ฒ•์„ ์•Œ์•„๋ณด์•˜๋‹ค. 

 

 private void getHashKey(){
        PackageInfo packageInfo=null;
        try{
            packageInfo= getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES);
        }
        catch (PackageManager.NameNotFoundException e){
            e.printStackTrace();
        }
        if(packageInfo==null){
            Log.e("HashKey","HashKey:null");

        }
        for(Signature signature:packageInfo.signatures){
            try{
                MessageDigest md=MessageDigest.getInstance("SHA");
                md.update(signature.toByteArray());
                Log.d("HashKey", Base64.encodeToString(md.digest(),Base64.DEFAULT));
            }catch (NoSuchAlgorithmException e){
                Log.e("HashKey","HashKey Error. signature=" + signature,e);
            }
        }
    }

 

์•ˆ๋“œ๋กœ์ด๋“œ์ŠคํŠœ๋””์˜ค์—์„œ ํ•ด๋‹น ์†Œ์Šค์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ๋กœ๊ทธ์บฃ์—์„œ HashKey๋ฅผ ๊ฒ€์ƒ‰ํ•˜์—ฌ ์–ป๋Š”๋‹ค.