Android APK에서 서명값 구하기

public static boolean checkSigneture(Context context){ PackageManager pm = context.getPackageManager(); try{ PackageInfo packageInfo = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES); // 通常[0]のみ for(int i = 0; i < packageInfo.signatures.length; i++){ Signature signature = packageInfo.signatures[i]; if(BuildConfig.DEBUG){ if(DEBUG_KEY.equals(signature.toCharsString())){ return true; } }else{ if(RELEASE_KEY.equals(signature.toCharsString())){ return true; } } } }catch(NameNotFoundException e){ e.printStackTrace(); } return false; } ]]>

Related Posts