GoTo: Make Your Own Android App Free | Browse
all Tutorials
ANDROID APIs
Updated August 2023
The latest Android platform in release as of now, August 2023, is Android 14 - Api 34.
For publishing your apps; at Google Playstore new apps must have their 'target SDK' 13/Api 33. At Amazon appstore(accepts android apps), they prefer you use the earliest target your app will support, to provide best user experience for Fire devices.
APIs in Code
Apis are coded in the apps
build.gradle page. You can easily find them; look for Min SDK, and Target SDK.
When you develop an android app you must select an API to run your app with. Basically an API is a code number that
equals a particular android platform version; example android 6 is API 23.
Selecting a platform version and API Level
From Android Developer Website: "When you are developing your application, you will need to choose the platform version against
which you will compile the application. In general, you should compile your application against
the lowest possible version of the platform that your application can support."and, "
If you build an application that uses APIs or system features introduced in the latest platform version, you should set the android:minSdkVersion attribute to the API Level of the latest platform version".
The API number is coded in the manifest.xml; in the USES SDK code element as shown in the example code on this
page. Where it says integer, simply replace that with the API number. It can also be coded in the 'build gradle' of your app project. If coded in both pages; the system uses the values from the build gradle. In AIDE, the SDKs are precoded for you in the app module build gradle. If you have to change them you can.
To find the API required for a code class your using, just look at the page at the android developer website for
that particular code class. It is shown in the top of the page.
For example;
goto this link, for the code class VIEW, and you can see the API for VIEW class was added at API 1.
You should code at least the MinSDK version and the TargetSDK version.
This will ensure that users can only run your app if they a compatible version of the platform, and also, that
your app will run without issue on their device.
For example: if the code you add to your app requires API 14, and your device (tablet) is android platform 4 then the code should
run without issue on your tablet because platform 4 is api 14. View all platforms and corresponding
APIs here, and the image on this page.
That API number is the required android:minSdkVersion. Add that number to the manifest.xml USES-SDK code element - android:minSdkVersion.
If you do not declare the minSDKVersion, the system assumes that the required API for your app is 1.
API Compatibility
Most APIs are compatible with newer versions of android platforms. Example, your coding components
that make use of the platform version 6 API 23, and you used this as your app API. And, lets say the next version is 7, and API 24.
Your app will still be able to
be installed and run without issue on devices running this newer android platform. However, it may not be able to run on android platforms
that are less than version,6, API 23.
Image showing Android newest Platforms to Android 13. Newest platform is now Android 14 - Api 34.
To solve this, Android has 'dependencies'; which are snippets or code classes created to make older platforms compatible with coding classes from the newer android platforms.
And, in some cases the code may still work but not present the screen display design as intended, or perform an action as intended.
For this reason, when using a feature and coding from newer platforms, it is best practice to include the 'dependency' code in the build gradle or androidmanifest.
It is usually just one or two lines of code. Once added, run and build your app code which will add the dependencies to your app, making the particular feature compatible on earlier platformed devices.
When API Not Coded
Your app will crash if it attempts to install on a device not supporting the android platform version required by the app.
For example: if your app is using the latest platform, but does not specify such in the SDK USES in the manifest.xml file AND
the app is installed on a device that DOES have the latest platform; the app will work.
However, when the same app trys to install on earlier versions of an android platform, it will crash because it does not have
access to the required APIs.
Standard Code Classes
Some 'basic features' code classes do function across all platform versions without requiring dependencies or the use of specific min SDKs. The basic 'View' code is considered a standard class as well as most 'Buttons' and 'Widgets' that are pre Material Design(ver 5, api 21). So, you can make an app without having to code any dependencies or set specific min SDKs. You would however, want to set your Target SDK to one of the latest releases; that being Api 30,for apps made currently this year.
For additional reading on APIs
browse here
Browse - Blog - More Articles
You May Also Like:
How To Submit Your App To Amazon App Store
AndroidAppCoding.com