Created
October 8, 2012 08:40
-
-
Save mttkay/3851440 to your computer and use it in GitHub Desktop.
Testing if an Android app is installed on the SD card
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 isAppInstalledToSDCard(Context context) { | |
PackageManager pm = context.getPackageManager(); | |
try { | |
int extStorage = ApplicationInfo.FLAG_EXTERNAL_STORAGE; | |
String package = context.getPackageName(); | |
ApplicationInfo appInfo = pm.getApplicationInfo(package, extStorage); | |
return extStorage == (extStorage & appInfo.flags); | |
} catch (NameNotFoundException e) { | |
e.printStackTrace(); | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment