Android Article - How to Implement Android Libaries
GoTo: Make Your Own Android App Free | View Android Articles

WHAT ARE ANDROID APIs


When you develop an android app you must select a API to run your app with. Basically an API is a code number that equals a particular android platform version; example android 8 and API 27.

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 file, with 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.

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 right 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 they 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 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 latest platform version7 API 24, and you used this as your app API. And, lets say the next version is 7.4, and API 25. Your app will still be able to be installed and run without issue on this newer android platform. However, it may not be able to run on android platforms that are less than version7, API 24.

What Happens 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.

For additional reading on APIs
browse here





You May Also Like These Android Articles: How To Scroll A View Android | What is a WebView- Android App Coding


If you Like Our Free Android Articles - Give Us a Social Mention Share