is Installed App - Android App

Android examples for App:App Install

Description

is Installed App

Demo Code


//package com.java2s;

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

import android.content.pm.PackageManager;

import java.util.List;

public class Main {
    public static boolean isInstalledApp(Context context, String packageName) {
        List<ApplicationInfo> appList = context.getPackageManager()
                .getInstalledApplications(PackageManager.GET_META_DATA);

        for (ApplicationInfo appInfo : appList) {
            if (appInfo.packageName.equals(packageName)) {
                return true;
            }/*from w  w  w  . j  a  v a2s  .co m*/
        }

        return false;
    }
}

Related Tutorials