On Thu, Jun 9, 2011 at 12:21 AM, Dom <[email protected]> wrote:
> Got it, thanks! Here's the snippet of code:
>
>             Signature[] sigs =
> getBaseContext().getPackageManager().getPackageInfo(getPackageName(),
> PackageManager.GET_SIGNATURES).signatures;
>             for(Signature sig : sigs)
>             {
>                 byte[] hexBytes = sig.toByteArray();
>                 MessageDigest digest = MessageDigest.getInstance("MD5");
>                 byte[] md5digest = new byte[0];
>                 if(digest != null)
>                 {

You can skip the null check, getInstance() will throw an exception if
the specified algorithm cannot be found.  Also, AFAIK, there is
only one Signature (actually certificate), so you just get sigs[0]
and skip the for loop.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to