importClass("java.security.MessageDigest"); importClass("java.lang.StringBuffer"); importClass("android.content.pm.PackageManager"); importClass("java.util.Locale"); info = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES); cert = info.signatures[0].toByteArray(); md = MessageDigest.getInstance("SHA1"); publicKey = md.digest(cert); hexString = new StringBuffer(); for (let i = 0; i < publicKey.length; i++) { appendString = java.lang.Integer.toHexString(0xff & publicKey[i]).toUpperCase(Locale.US); if (appendString.length == 1) hexString.append("0"); hexString.append(appendString); hexString.append(":"); } result = hexString.toString(); r = result.substring(0, result.length - 1); log(r);