์๋๋ก์ด๋ ์ฑ์ ์นด์นด์ค ๋ก๊ทธ์ธ ์ฐ๋์ ํ๊ธฐ์ํด ํด์ํค ๊ตฌํ๋ ๋ฒ์ ์์๋ณด์๋ค.
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๋ฅผ ๊ฒ์ํ์ฌ ์ป๋๋ค.
'ANDROID' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[์๋๋ก์ด๋] SharedPreference ์ฌ์ฉ๋ฒ (ํ์ฌ ๋ฐ์ดํฐ ์ ์ฅ/์ฑ ์ค์ ๋ง๋ค ๋ ์ ์ฉ) (0) | 2020.08.02 |
---|---|
[์๋๋ก์ด๋] ListView ์ฌ์ฉ๋ฒ (0) | 2020.08.02 |
[์๋๋ก์ด๋] ํ๋ฉด ์ ํ ๋ฐฉ๋ฒ (0) | 2020.08.02 |
[์๋๋ก์ด๋] ์ฑ์ ๋์ ๋ณํ ๋ฃ๋ ๋ฐฉ๋ฒ (0) | 2020.08.02 |
[์๋๋ก์ด๋]์ฑ์ ์ด๋ฏธ์ง ๋ฃ๋ ๋ฐฉ๋ฒ(ImageView) (0) | 2020.08.02 |