I have seen lots and lots of question on targetsdk version in android. but not pretty clear about the explanation. i think its bit tricky compared to minsdk and maxsdk version. i had gone through developer.android.com and read about uses sdk tag, and few video explaining this concept. but dint get clear picture of targetsdk version. as i said before there are already thousands of question and answers on stack overflow, i am posting this again to get simple and clear solution for this problem. so please guys kindly bear with this question and help me out.
This is statement in developer.android.com.
However, if the API level of the platform is higher than the version declared by your app's targetSdkVersion, the system may enable compatibility behaviors to ensure that your app continues to work the way you expect. You can disable such compatibility behaviors by specifying targetSdkVersion to match the API level of the platform on which it's running.
I did small sample where i specified targetsdkversion to 14 and i tried to run on android api level 19 (android 4.4), my app was installed without any problem and is working fine.
if i remove targetsdkverion then by default it will be set to minsdkversion value , and again my app got installed and is working fine.
My sample and the above statement both are contradicting, so i am getting confused about the concept. kindly explain me in details with a simple explanation to with video tutorial.
Q1) now if i specify targetsdkversion will there be forward compatibility? ( i hope that backward compatibility will be there rite.
Q2) why everyone say that we should always set targetsdk version to latest version release?
Q3) In what scenarios do we have to specify targetsdkversion lower than latest version release number. and what are the effects of this? (i.e targetsdkversion = 14 and maxsdkverion= 19).
Please guys need your help on this. Thanks..