android - Target KitKat MR2 (4.4.3)? -
i have piece of code (actually library i'm including) functions correctly using kitkat mr2 (4.4.3).
the other mr seem have own api versions in build.version_codes, can't find way target 4.4.3 , above using sdk_int. should use incremental string field , string comparison?
// "easy" (wrong) way if(build.version.sdk_int >= build.version_codes.kit_kat) { // includes 4.4, 4.4.1, , 4.4.2! } // "hard" way if(compareversioncodes(build.version.release, "4.4.3") > 0) { // implement comparison function version codes instead }
is targeting kit_kat acceptable -- meaning version 14 vs 15 automatically gets higher version?
i can't find way target 4.4.3 , above using sdk_int
the api levels changes in binary compatibility -- stuff new classes, new methods, etc. aren't bug fixes, other extent such fixes break binary compatibility.
should use incremental string field , string comparison?
that's not awesome, unless there's way can interrogate bluetooth le apis see whether or not you're on malfunctioning device, may need go route. however, later year, i'd set check algorithm more like:
if (build.version.sdk_int >= build.version_codes.whatever_they_call_l || (build.version.sdk_int == build.version_codes.kit_kat && getpatchlevel()>=3)) { // thing }
where getpatchlevel()
tries use release
find patch level , fails gracefully if release
not of form x.y.z. approach handle both 4.4.3/4.4.4 scenarios , whatever numbering next android version.
Comments
Post a Comment