I'm new on Android development and curious about ConnectionService. I see a doc and it mention that it's coming from Android API 23. If my project use useTargetVersion=25 and minTargetVersion=16, can I still use ConnectionService? Can it guarantee that it's working on Android API 16 device?
It won't work on API less than 23. You'll need to check Android API version in app before using it to see if it is compatible.
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// Use ConnectionService()
} else {
// do something else
}
You can also avoid lint issues by using the decorator
@TargetApi(Build.VERSION_CODES.M)
over the method in question. https://developer.android.com/reference/android/annotation/TargetApi.html