Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implications of setting a lower targetSdkVersion for the app

Tags:

android

sdk

I have read the Android documentation here and this similar question here, but have a question on the real life implications of this version.

My app had a targetSdkVersion of 25 while in development, and I was trying it out with a SDK level 27 (Android 8.1) phone with no issues.

My question is specifically about broadcast receivers. Prior SDK 26, you can register for broadcasts in manifest file and you will receive all the broadcasts you registered for. But 26 changed that to severely limit this mechanism that you cannot receive any implicit broadcasts, like Wifi connection changes. And instead they recommend using JobScheduler, with a minimum period of 15 minutes. This would absolutely not work for my app.

Now what I want to understand is, what are the implications of releasing my app with a target SDK version of 25, given that I do not use any features of latest SDK (27)?

Would there be any restrictions for a phone running SDK > 25 to use my app?

Thank you.

like image 274
madu Avatar asked Sep 01 '25 21:09

madu


1 Answers

The scenario you are mentioning is know as forward compatibility in Android. You can think it in other way as well, you app is already in Google Play Store and user updated his device software. In such case, Android/Google strongly focus on that existing apps built against prior SDKs should not break when the user updates to a new version of Android.

If any API of API level 25 you are using in your app is not deprecated in API level 27, there is no issue. It is completely fine to set targetSdkVersion : 25.

But it is always recommended to compile your app with latest available SDK so that you can minimize the risk of crash/warnings of your code with respect to latest SDK.

So basically what you should follow is:

minSdkVersion <= targetSdkVersion <= compileSdkVersion

Hope this will help you.

like image 126
Vikasdeep Singh Avatar answered Sep 03 '25 11:09

Vikasdeep Singh