get Package Info - Android App

Android examples for App:Package

Description

get Package Info

Demo Code


//package com.java2s;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

public class Main {
    private static PackageInfo getPackageInfo(Context context) {
        PackageInfo pi = null;/*from ww  w  .ja va  2  s .  c  o  m*/

        try {
            PackageManager pm = context.getPackageManager();
            pi = pm.getPackageInfo(context.getPackageName(),
                    PackageManager.GET_CONFIGURATIONS);

            return pi;
        } catch (Exception e) {
            e.printStackTrace();
        }

        return pi;
    }
}

Related Tutorials