I have a mildly successful app that targets Android 1.6 and am looking to upgrade the target API to 2.1 in order to include more features.
What will happen to those still using android 1.6? Will they just not see the update? I'd love to be able to check which api the user is using and implement code based on that within the same app.
It's a paid app so making a new separate version is out of the question.
Hey Dom Read this question it's the exact answer:
What if I want to release an update with higher minSDK than the one on the market?
Yes you can check the API code and use reflection to only allow methods to work for 2.1, see above link
Depends on how you write the new version of your app.
If the new features have equivalents in 1.6, just that new APIs are used, you may be in the "old Contacts vs new Contacts API" boat. See Using the Contacts API and search for 'legacy'.
Search the above link for Supporting the old and new APIs in the same application for sample code to select APIs based on current OS version.
If you can code your app so it still runs on 1.6 and newer OSes even though you use new APIs, then you'll need to modify the uses-sdk element in the AndroidManifest.xml to tell Android you can handle the older OSes. See AndroidManifest.xml uses-sdk element.
Related
I'm new to Android developing, and I would like to know what is the connection or difference between the version and the API level. What is each one referring to? And what does it mean when I decide to develop some app for API 14 or for android version 4.0?
Or is one a subset of the other? I simply didn't get the difference, and why are there two counters?
Thanks
Well, API is for development, so the changes in new API version are more "inside". But new version of Android usually adds more features for users, that are "visible".
Check this page http://developer.android.com/guide/appendix/api-levels.html, there is a table that shows relations between versions and API levels.
Multiple versions of Android can have the same API level but the API as an integer allows developers to more easily target devices. The chart below will give you an idea of their relationship but only the documentation contains exhaustive listings of the API levels and how they differ from each other.
Source: developer.android.com.
Because this data is gathered from the new Google Play Store app, which supports Android 2.2 and above, devices running older versions are not included. However, in August, 2013, versions older than Android 2.2 accounted for about 1% of devices that checked in to Google servers (not those that actually visited Google Play Store).
In addition to the answers provided, there is a detailed explanation of the Android Platform usage on Wikipedia (permalink).
This table will give you a highlight of Android API vs Version.
API Level is an integer value that uniquely identifies the framework API revision offered by a version of the Android platform.
You can have a new Android version with the same API release as the previous version.
Check out https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels
A device running Android with version X will usually support applications written for API X and below.
This means if you want your app to support API 8, devices ver 8 will be able to run it, but also devices of ver 9, 10, 11, etc.
Here is the table which explains the ties between the numbers:
http://developer.android.com/guide/appendix/api-levels.html
In a short note:
Main difference between them is that API level for android application development framework API on the other hand android version is maintained to mention new features to user level.
In details:
API Level is an integer value that uniquely identifies the framework API revision offered by a version of the Android platform.
The Android platform provides a framework API that applications can use to interact with the underlying Android system. The framework API consists of:
A core set of packages and classes
A set of XML elements and attributes for declaring a manifest file
A set of XML elements and attributes for declaring and accessing resources
A set of Intents
A set of permissions that applications can request, as well as permission enforcements
included in the system
For more details you can visit this link:
https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels
API = a set of functions and procedures allowing the creation of applications that access the features or data of an operating system, application, or other service.
Android = Android is a mobile operating system developed by Google.
So if we develop new API with new features they can be not supported in old android operation system, so we take old operation system , ++ version add support for new API and there we go (:
on the other hand if we have new operation system with new features we want to upgrade old API to support it, so we ++ version of the API.
Sound weird yeah ?
In simple words:
Android Version : Android is basically a mobile operating system developed by a consortium of developers known as the Open Handset Alliance and commercially sponsored by Google and they keep on updating Android by adding new features. So every new version of android have a version number known as Android version
API Level : API Level allow us to specify an app's/application's compatibility with one or more versions of Android, by means of an integer. Each versions of Android is associated with an API Level. So on a device the API Level expressed by an app/application is compared to the API Level associated with the version of the Android installed on the device.
According to Android M Changes page, there is a new platform changes for Android 6.0. and they saying that
If you have previously published an app for Android, be aware that these changes in the platform affect your app.
So if my app is previously released before Android M release, and my app targeting API 21
1- Does this new changes will affect it?
2-Does i have to update my code to follow this new changes to be compatible with Android Mand raise the API Level to be 23?
** take in consideration in Android developer they says
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.
Does this forward compatibility is applied to the Android M changes or not?
** i know this is a foolish version and i am daft man but please i need a help.
Does this new changes will affect it?
Some will. For example, while all of your permissions that you request in the manifest will be granted at install time (as they used to), the user can go in and deny them to your app in Settings. However, usually, all this will do is block access to data from your app, in ways that you should be handling already. For example, you might ask for READ_CONTACTS and query ContactsContract, but you should be handling the case where the user has no contacts. On Android 6.0, you might get no contacts in response to your query because the user denied your app access to contacts.
Does i have to update my code to follow this new changes to be compatible with Android Mand raise the API Level to be 23?
Generally speaking, no. Older Android apps usually work fine on Android 6.0.
However, eventually, there will be something that you want to have that requires targetSdkVersion of 23 or higher, in which case you will need to take other changes into account, such as the runtime permissions. And, you will need to test your app on Android 6.0, to see if Android 6.0's changes trigger bugs in your code.
As a newbie I am not sure how do I make sure my app works between certain android version range. According to latest statistics, it seems that 2.3.3 (gingerbread) is still heavily used out there (other than ICS and JB). But now that Kitkat has made its way, many apps are updated to support that as well while still keeping compatibility with older versions of android.
So essentially what are general guidelines to support latest version of android as well as specified minimum old version. For example, how do I make sure my app works starting from 2.3.3 (gingerbread) to latest 4.4 kitkat ?
Also can emulators be used to make sure app works in specified range?
P.S: I know that can be specified via app manifest file but that's not my question I am just looking for how to actually make app compatible between the two versions.
Thanks for your suggestions and helpful ideas :)
You have different approaches to reach that goal.
First thing:
Despite the min sdk you want to support you should always use the latest sdk to build your app.
At this point, choose the min sdk you want to support and declare it inside the manifest.
If you are using eclipse with lint enabled it will be very easy at this point to spot if you are using unsupported api for that platform level.
If you want to use a new api and make it only available on newer devices you have basically two approaches:
use reflection (discouraged)
use #TargetApi annotation on the methods that use new api and call
those methods only on devices on which those api are available
if(Integer.valueOf(android.os.Build.VERSION.SDK)>whatlevelyouwant){
callMethodWithNewAPI();
}
You can find a lot of information on Google's 'Support Different Versions' Site: http://developer.android.com/training/basics/supporting-devices/platforms.html
Generally it says that you should support 90% of the devices out there (which means you can leave out Android 2.2, but should start with 2.3).
However, some new apps don't start with 2.3 but start with 4.0. This makes life much easier in words of testing.
In ADT you can use the ADV to generate differents emulators, one for each Android version you want to support and test.
It´s not as good as a real device but a useful starting point
You can define MinSdk and maxSdk in your manifest file.. This will define which Android Versions will be supported by your application.
android:minSdkVersion
An integer designating the minimum API Level required for the application to run.
android:maxSdkVersion
An integer designating the maximum API Level on which the application is designed to run.
So if you want your app to be compatible with 2.3 to the latest version you can define in your manifest file :
<uses-sdk
android:minSdkVersion="8" />
If you don't specify maxSdkVersion, it will take the latest released android version. So this line impllies your application is compatible with all devices having android 2.3 or above ..
I am trying to decide what target API should I choose to build my next android app. I know that Gingerbread was a major upgrade over Froyo and thus I want to use API 10(2.3.3). Also the report from Google tells me that Gingerbread 2.3.3 now has 61.5% of market share(http://developer.android.com/resources/dashboard/platform-versions.html).
The thing is at this point of my project I am not very sure if the LocationManager and other API enchancement in Gingerbread will if of use, though my app will definitely use them. If I use 2.2 for development then I can target a greater audience.
My question is, will it be possible for 2.2(Froyo) users to install and run my 2.3.3(gingerbread) app if I dont use any new API's introduced in 2.3 SDK?
Edit : If the answer is no, what would you guys suggest me to do, being it March 2012 now and the pace with which updates are coming? Should developers start with minimum 2.3.3 now, seeing the bugfixes and enhancements been introduced in it, not to mention the top market shareholder.
You could target 10 as API level, but define a minSdkVersion of 8 or so in your manifest. This will enable users of Froyo devices to install your app. But you have to ensure, that you don't use any API calls which are exclusive to API level 10. If you need to use functions introduced in API level 10 you should use them via reflection and either reimplement the missing functionality for pre API level 10 or notify the user of the missing functionaltiy.
If you target your application at API 10, 2.2 users won't be able to install it, even if you don't use any new API methods.
If you keep your application at Android 2.2, 2.3 users will still be able to install and use it. See the documentation for more.
If I target my Android app for version x, will it have any problems if the user uses an Android version above x?
What will I have to watch out for?
Yes, it's should work.
Updates to the framework API are designed so that the new API remains
compatible with earlier versions of the API. That is, most changes in
the API are additive and introduce new or replacement functionality.
As parts of the API are upgraded, the older replaced parts are
deprecated but are not removed, so that existing applications can
still use them. In a very small number of cases, parts of the API may
be modified or removed, although typically such changes are only
needed to ensure API robustness and application or system security.
All other API parts from earlier revisions are carried forward without
modification.
Take a look at this
Yes! It should work on upper versions of the sdk without error. But you should carefully read the release notes