get Package Information Signs - Android App

Android examples for App:Package

Description

get Package Information Signs

Demo Code


import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;

public class Main {
  public static PackageInfo getPackageInfoSigns(PackageManager pm, String name) {
    PackageInfo ret = null;//ww  w . j  ava2  s.  c  o m
    try {
      ret = pm.getPackageInfo(name, PackageManager.GET_SIGNATURES);
    } catch (NameNotFoundException e) {
      // e.printStackTrace();
    }
    return ret;
  }

  public static PackageInfo getPackageInfo(PackageManager pm, String name) {
    PackageInfo ret = null;
    try {
      ret = pm.getPackageInfo(name, PackageManager.GET_ACTIVITIES);
    } catch (NameNotFoundException e) {
      // e.printStackTrace();
    }
    return ret;
  }
}

Related Tutorials