Selectively disable an Android service for certain API levels

前端 未结 1 1116
孤独总比滥情好
孤独总比滥情好 2020-12-21 07:02

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 <

1条回答
  •  囚心锁ツ
    2020-12-21 07:48

    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+

    0 讨论(0)
提交回复
热议问题