Made an app targeting API8 and it’s running fine
on all emulator images all the way up to API15.
I cannot test the app on other higher apis so I’m not
setting the android:targetSdkVersion.
What about this deprecated warnings:
android.view.Display.getHeight()
This method is deprecated.
Use getSize(Point) instead.
Can I ignore this and just keep on using Display.getHeight()?
I read about reflection or programmatically testing what Android version the device is using.
Why do people do that when it’s working for me?
If you are testing “on all emulator images all the way up to API15”, then you are “test[ing] the app on other higher apis”.
In Android, “deprecated” usually means “we have a better solution that you should consider using, but we will keep the deprecated one working as long as we can”. Sometime after you drop support for API Level 12 and down, you might wish to move to
getSize(). For now,getHeight()should work fine on all Android API levels.They do not do that for deprecated APIs. They use version checks and the like for accessing things that simply do not exist in older versions of Android, so they do not try referring to non-existent APIs on older devices.