Last active
August 29, 2015 14:18
-
-
Save TowkayNew/08b7a8c25503003fcb68 to your computer and use it in GitHub Desktop.
Method to check whether Android package is installed and enabled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private boolean isPackageEnabled(String packageName, Context context) { | |
PackageManager pm = context.getPackageManager(); | |
try { | |
ApplicationInfo ai = pm.getApplicationInfo(packageName, PackageManager.GET_ACTIVITIES); | |
return ai.enabled; | |
} catch (PackageManager.NameNotFoundException e) { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment