Android "Unknown Source" Setting error for API > 17 -
i have confusing problem,
if make change in anywhere, @ "global.getint" part (last line), there error
"call requires api level 17 (current min 4): android.provider.settings.global#getint"
after making project-> clean, red error disappearing itself. error comes why?
public void buton2(view view) throws settingnotfoundexception{ boolean isnonplayappallowed = false; { if (build.version.sdk_int < 5) { isnonplayappallowed = settings.system.getint(getcontentresolver(), settings.system.install_non_market_apps) == 1; } else if (build.version.sdk_int < 17) { isnonplayappallowed = settings.secure.getint(getcontentresolver(), settings.secure.install_non_market_apps) == 1; } else { isnonplayappallowed = settings.global.getint(getcontentresolver(), settings.global.install_non_market_apps) == 1; }
thanks!
call requires api level 17 (current min 4): android.provider.settings.global#getint
it tells code contains method added in api 17 compiler complaining. because you're doing checks in regards of api on phone, add above method signature, looks this:
@targetapi(build.version_codes.jelly_bean_mr1) public void buton2(view view) throws settingnotfoundexception
Comments
Post a Comment