File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
utilcode/src/main/java/com/blankj/utilcode/util Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 44import android .app .Activity ;
55import android .app .ActivityManager ;
66import android .content .Context ;
7+ import android .content .Intent ;
78import android .content .pm .ApplicationInfo ;
89import android .content .pm .PackageInfo ;
910import android .content .pm .PackageManager ;
11+ import android .content .pm .ResolveInfo ;
1012import android .content .pm .Signature ;
1113import android .graphics .drawable .Drawable ;
1214import android .util .Log ;
@@ -29,6 +31,21 @@ private AppUtils() {
2931 throw new UnsupportedOperationException ("u can't instantiate me..." );
3032 }
3133
34+ /**
35+ * 判断App是否安装
36+ *
37+ * @param action action
38+ * @param category category
39+ * @return {@code true}: 已安装<br>{@code false}: 未安装
40+ */
41+ public static boolean isInstallApp (final String action , final String category ) {
42+ Intent intent = new Intent (action );
43+ intent .addCategory (category );
44+ PackageManager pm = Utils .getApp ().getPackageManager ();
45+ ResolveInfo info = pm .resolveActivity (intent , 0 );
46+ return info != null ;
47+ }
48+
3249 /**
3350 * 判断App是否安装
3451 *
You can’t perform that action at this time.
0 commit comments