Does it matter? Normally I set minimum as lowest as Android 2.3.1 (api level 9) unity support.
But is this ok?
Normally recently almost all android users uses newest OS, at least over 4.1 (jellybean), isn’t it? I don’t know well but I guess almost all users already uses over 5.0 (lollipop).
Then, why I should set as lowest as it? or, why I should set to newest API?
Are there difference other than user with lower API level can’t install my game?
Of course it’s up for you to decide.
Here go some numbers: http://hwstats.unity3d.com/mobile/os-android.html
Setting min SDK to Android 4.0 will make you loose (estimated) less than 1% of your audience.
This value is used by Google Play to filter out the devices. If you set min SDK to Android 4.0, your game won’t even show up on devices running Android 3.x and earlier versions.
Another thing to consider is that older Android devices usually have older and weaker hardware.
Well, the performance mostly depends on the device hardware. Of course Google is improving things over Android versions, but hardware is the most important thing.
What I would like to know is does Unity produce more optimized code that yields better performance due to it using newer API functions available to it.
If I have the exact same game and I build two apk files, one with a Minimum API of 16 and one with a Minimum API of 23. Then run them both on the exact same device that is running Android 7.1 (API Level 25) will the API level 16 game have the exact same performance characteristics as the API level 23 game?
I recommend going with API level 19. I think going for a lower api level to gain a wider audience will be offset by the effort in supporting it. You’ll have increased chances of issues with older devices ie. bad ratings due to crashes, more purchase returns etc. You’ll have a better chance at level 19 that devices have a minimum of 512mb ram, and also I’ve found that due to the relaxing of external read/write permissions as of api level 19 (in my case at least) I’ve not had to deal with as much in getting a build out that works on all OS versions ie. less differences between OS versions to deal with.
So you are saying there is 0 difference in the application code generated by Unity (other than the manifest.xml) and the only thing setting a higher minimum does is guarantee a higher minimum hardwarare level.
I just want to confirm that you are saying the answer to my question:
Is “A game running on Andorind 7.1 running API level 16 has will 100% for sure have the exact same performance characteristics as the same game built with a API level 23 on the same device”
No I wouldn’t assume all of that just by raising the minimum supported SDK level. There’s many factors that can change an application that will run differently over a range of devices, for example if the graphics API is configured to support OpenGLES2, OpenGLES3 and Vulkan you’re going to have potential differences in how the app runs depending on what device the app is running on. Similarly if you have the device filter set to FAT to support both Armv7 and 86x build architectures than you’ll effectively have two underlying executables bundled together, either of which could in theory have differences in behaviour (but shouldn’t). so no it’s that simple to just say there’s zero differences.
I was more talking about the code that I need to write to support certain API levels. In my case for example I don’t need to be writing any code like ‘if running this version of android do this, but if running some other version do this instead’ type functionality, but that’s not to say under the hood that Unity doesn’t generate code that will run differently on different devices.
I would really like to hear a definitive answer from Unity staff on will Unity output better optimized code if I target a higher minimum API level and if there is there any kind of metrics available about “the kinds of performance changes will you see running the same project on the same hardware but with a different minimum API level set”
I very seriously doubt that unity produces any different “optimized code” based on what your min api is set to. There may be some tweaks to things to make sure it runs under a certain version properly, that won’t be applied if the min api version is higher, but as far as optimization through changing that - don’t expect any.
There are (of my apps and games users) less than maybe 2 percent of people on anything less than android 4.0, so that means you only lose a very small portion of users and gain some features for supporting only 4.0 and higher. For instance, admob and google play services I think both require android 4.0 and higher if I remember correctly, and compute shaders won’t work on older devices without the new opengl version, so that is another thing to consider.
What I do is set the min API to as low as possible without messing with any plugins, and forget the rest
If you really wanted to know though, you could always produce a performance test and build separate versions, and then test on your own devices…
The “new APIs” you are talking of are probably Java APIs - we don’t make use of may of them. And we check for the Android version of the device before running newer APIs, so running on Android 6 will result in showing the permission dialog, regardless of the min API setting.
I can’t answer for all the compiler optimizations, but I’m 99.9% sure there is no difference depending on the minimum API level setting.
Does target API level mean that my game won’t run for the target API level ? So it’s an option for us to prevent our game from running for the target API level ? I’m new to this topic so sorry…
No, target means that you are targeting this API level, so you have tested your app on the device with this API level and you know that your app runs well with this API level. If you want to specify the maximum API level where your app can run, you should create a custom manifest and specify maxSdkVersion, though it is not recommended to use it. You can read more here <uses-sdk> | App architecture | Android Developers
So just to clarify. Does that mean selecting AUTOMATIC HIGHEST INSTALLED, will mean exactly that? It will install on all the versions in between MINIMUM API and newest available API ? Please clarify because I have issues with my games only running on specific API when I specifically want them to run on all available.