GetSignature.java public void signature() { String className = Thread.currentThread().getStackTrace()[3].getClassName(); String methodName = Thread.currentThread().getStackTrace()[3].getMethodName(); Log.w(TAG, className + "," + methodName)
public void signature() { String className = Thread.currentThread().getStackTrace()[3].getClassName(); String methodName = Thread.currentThread().getStackTrace()[3].getMethodName(); Log.w(TAG, className + "," + methodName); String pkgName = "com.jingdong.app.mall";//com.tencent.mobileqq try { PackageManager pkgmanager = getPackageManager(); PackageInfo packageInfo = pkgmanager.getPackageInfo(pkgName, PackageManager.GET_SIGNATURES); Signature[] signatures = packageInfo.signatures; for (Signature signature : signatures) { Log.w(TAG, packageInfo.packageName + " signature=" + signature.toCharsString()); } Signature signature1 = new Signature("30820247308201b0a00302010202044d6c5dae300d06092a864886f70d01010505003068310b300906035504061302636e3110300e060355040813076265696a696e67310e300c060355040713056368696e613111300f060355040a13086a696e67646f6e673111300f060355040b13086a696e67646f6e673111300f060355040313086a696e67646f6e67301e170d3131303330313032343530325a170d3338303731373032343530325a3068310b300906035504061302636e3110300e060355040813076265696a696e67310e300c060355040713056368696e613111300f060355040a13086a696e67646f6e673111300f060355040b13086a696e67646f6e673111300f060355040313086a696e67646f6e6730819f300d06092a864886f70d010101050003818d00308189028181008c470af7c751ee12edbae8dd9e7c98fa60d3c631efa0f7172ed36c86bb85c8288391e718c05fdbef008d61f2e8fce4ef4457a69ae5a2fa53ead0c806c18f8b475847c07bf4451d82845efc30d5fc4aa2500f4bc84234a36749e83a9361c9ec89771a762e3d791eebf3154c2e95d06df95be68b4a4dcff33ef1ba5d6d90758b6d0203010001300d06092a864886f70d010105050003818100821db5cf6e40d98e9b0e2a6a8ad09a0c52435e82df79d16fa8a3fea8f135f40cceedd3e98c18d0ef4bb5f5cfeccea3311d14e48cce863f520bc8b71491287fe5559d06a8a20446e168da5f488f971f473220ce619976e2286ce353b6882016d9978309edb3200a7aa0a5d5c8e39a7d9d612d9a6fc210d878f40d0860a59cd432"); Log.e(TAG, "s=" + signature1.toCharsString()); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } }