Example usage for android.content.pm PackageManager GET_UNINSTALLED_PACKAGES

List of usage examples for android.content.pm PackageManager GET_UNINSTALLED_PACKAGES

Introduction

In this page you can find the example usage for android.content.pm PackageManager GET_UNINSTALLED_PACKAGES.

Prototype

int GET_UNINSTALLED_PACKAGES

To view the source code for android.content.pm PackageManager GET_UNINSTALLED_PACKAGES.

Click Source Link

Usage

From source file:com.codename1.impl.android.AndroidImplementation.java

/**
 * Indicates whether this is a Google certified device which means that it
 * has Android market etc./*from   w  w w .  ja  v a  2  s .  c o  m*/
 */
public static boolean hasAndroidMarket(Context activity) {
    final PackageManager packageManager = activity.getPackageManager();
    List<PackageInfo> packages = packageManager.getInstalledPackages(PackageManager.GET_UNINSTALLED_PACKAGES);
    for (PackageInfo packageInfo : packages) {
        if (packageInfo.packageName.equals(GooglePlayStorePackageNameOld)
                || packageInfo.packageName.equals(GooglePlayStorePackageNameNew)) {
            return true;
        }
    }
    return false;
}