Here you can find the source of isAppInstalled(Context context, String uri)
Parameter | Description |
---|---|
context | Context of current app |
uri | Package of application to check |
public static boolean isAppInstalled(Context context, String uri)
//package com.java2s; // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of import android.content.Context; import android.content.pm.PackageManager; public class Main { /**/*www . j a va2 s . co m*/ * Check if package installed * * @param context Context of current app * @param uri Package of application to check * @return true if passed package installed */ public static boolean isAppInstalled(Context context, String uri) { PackageManager pm = context.getPackageManager(); boolean appInstalled; try { assert pm != null; pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES); appInstalled = true; } catch (PackageManager.NameNotFoundException e) { appInstalled = false; } return appInstalled; } }