Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

import java.io.File;

public class Main {
    public static PackageInfo getAPKInfo(Context c, File apk) {
        if (!apk.exists())
            return null;
        String archiveFilePath = apk.getAbsolutePath();
        PackageManager pm = c.getPackageManager();
        //PackageManager.GET_ACTIVITIES = 1
        PackageInfo info = pm.getPackageArchiveInfo(archiveFilePath, 1);
        return info;
    }
}