get Install Apk Path - Android App

Android examples for App:App Install

Description

get Install Apk Path

Demo Code


//package com.java2s;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager.NameNotFoundException;

public class Main {
    public static String getInstallApkPath(Context context,
            String packageName) {
        String path = "";
        try {//w w w .  j av  a2 s.c  o  m
            ApplicationInfo pInfo = context.getPackageManager()
                    .getApplicationInfo(packageName, 0);
            path = pInfo.sourceDir;
        } catch (NameNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return path;
    }
}

Related Tutorials