Question

I'm trying to use AlarmClock in my app, but I'm using android 2.2 and have a error message saying that Field requires API level 9 (current min is 8). What can I do?

Était-ce utile?

La solution

Either:

  1. Increase your android:minSdkVersion to 9, or

  2. Don't use AlarmClock at all, or

  3. Check Build.VERSION.SDK_INT to see if you are on Build.VERSION_CODES.GINGERBREAD or higher, and only use AlarmClock on devices where this is true (then add the TargetApi(Build.VERSION_CODES.GINGERBREAD) annotation to the method where you are using AlarmClock to get rid of the error message)

AlarmClock itself was only added in API Level 9, and therefore cannot be used on API Level 8 or below.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top