About new and deprecated methods in the Android API
I’m new to Android development.
I’m studying with outdated books, so I’m really confused about new approaches.
I intend to make a simple and lightweight app that will even run on older devices.
So when I create a new android project, I set the “Minimum Required SDK” to API 8, the “Target SDK” to API 22, and the “Compile With” to API 22.
Does this setting mean that the application can run on API 8 devices, even if I use API 22 methods?
I ask this question due to the deprecated method.
I did nearly half of my app development with deprecated apps.
Can I swap them all for new ones?
Or do I have to prepare multiple code using different methods to support different platform versions?
(Old version of deprecation method, new version of new method?) )
Solution
Does this setting mean the app can work on the devices of API 8, even though I use the methods of API 22?
Yes. The min SDK version is used to restrict the use of applications by devices running operating systems at API level < minsdk. Your app won’t appear on the Play Store on these devices.
I’m asking this question due to deprecated methods.
I haven’t had any problems so far due to the depreciation method. However, I recommend using a minimum SDK version of 14 because Google has introduced many UI tweaks and enhancements. If you do some market research, using minsdk version = 14 will cover about 85% of the Android market.
Can I just replace them all with new ones?
Yes, you can.
Or do I have to prepare multiple codes using different methods to support different platform versions?
(deprecated methods for older versions, and new ones for newer versions?)
You can too. Older versions do not support fragments. Fragments greatly improves the user experience on tablets. Similarly, the Material design of the Lollypop device is great. There are not many examples where you can choose an API-level specific implementation. However, it is better to switch to API level >= 14