File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
library/src/main/java/com/nekolaboratory Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 11package com .nekolaboratory ;
22
3-
43import android .app .ActivityManager ;
54import android .content .Context ;
5+ import android .content .Intent ;
66import android .content .pm .ApplicationInfo ;
77import android .content .pm .PackageManager ;
8+ import android .content .pm .ResolveInfo ;
89import android .os .Build ;
910
1011import java .io .File ;
@@ -190,6 +191,16 @@ private static boolean checkFiles(String[] targets) {
190191
191192 public static boolean checkPackageName (Context context ) {
192193 final PackageManager packageManager = context .getPackageManager ();
194+
195+ Intent intent = new Intent (Intent .ACTION_MAIN , null );
196+ intent .addCategory (Intent .CATEGORY_LAUNCHER );
197+
198+ List <ResolveInfo > availableActivities = packageManager .queryIntentActivities (intent , 0 );
199+ for (ResolveInfo resolveInfo : availableActivities ){
200+ if (resolveInfo .activityInfo .packageName .startsWith ("com.bluestacks." )) {
201+ return true ;
202+ }
203+ }
193204 List <ApplicationInfo > packages = packageManager
194205 .getInstalledApplications (PackageManager .GET_META_DATA );
195206 for (ApplicationInfo packageInfo : packages ) {
You can’t perform that action at this time.
0 commit comments