Skip to content

Instantly share code, notes, and snippets.

@charsyam
Created August 26, 2013 08:12
Show Gist options
  • Save charsyam/6339107 to your computer and use it in GitHub Desktop.
Save charsyam/6339107 to your computer and use it in GitHub Desktop.
public class MarketUnknownSourceInformation {
public static boolean getMarketUnknownSourceInformation() {
boolean unknownSource = false;
if (Build.VERSION.SDK_INT < 3) {
unknownSource = Settings.System.getInt(getContentResolver(),
Settings.System.INSTALL_NON_MARKET_APPS, 0) == 1;
} else if (Build.VERSION.SDK_INT < 17) {
unknownSource = Settings.Secure.getInt(getContentResolver(),
Settings.Secure.INSTALL_NON_MARKET_APPS, 0) == 1;
} else {
unknownSource = isInstallNowMarketApps();
}
return unknownSource;
}
@TargetApi(17)
private static boolean isInstallNowMarketApps() {
return Settings.Global.getInt(getContentResolver(), Settings.Global.INSTALL_NON_MARKET_APPS, 0) == 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment