My Android app supports API 8+, however the Parse library seems to break completely on APIs less than 10 (and even a little bit on 10 too). I know how to disable blocks of code on certain API levels, but is there a way that a <service>
declared in AndroidManifest.xml
can be selectively enabled only for API 11+? (it also gets started up by the BOOT_COMPLETE
<intent>
which would also need to be disabled)
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Step #1: Create a res/values/bools.xml
file, with a bool
resource named i_can_haz_parse
, set to false
Step #2: Create a res/values-v11/bools.xml
file, with a bool
resource also named i_can_haz_parse
, set to true
Step #3: Have android:enabled="@bool/i_can_haz_parse"
on the components, like your service, that you want only on API Level 11+