get Apk Signatures - Android App

Android examples for App:APK Information

Description

get Apk Signatures

Demo Code


//package com.java2s;
import android.content.Context;

import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.text.TextUtils;

public class Main {

    public static Signature[] getApkSignatures(Context context,
            String apkPath) {//from  w ww .j  a v  a 2 s. c o m
        if (context == null || TextUtils.isEmpty(apkPath)) {
            throw new NullPointerException(
                    "Context is null or apk path is null");
        }
        return context.getPackageManager().getPackageArchiveInfo(apkPath,
                PackageManager.GET_SIGNATURES).signatures;
    }
}

Related Tutorials