Sri
Sri

Reputation: 5845

Building an app across different Android platforms?

I see a whole bunch of platforms / SDKs, everything from 1.x to 4.x.

Does this mean I have to build my app separately for all different versions?

My goal is to wrap my HTML5 web app and make it available as a native app in app stores.

Upvotes: 0

Views: 81

Answers (2)

Knickedi
Knickedi

Reputation: 8787

Usually you can write an application targeting android 1.6 and deploy it to every device which supports a higher API level. You can compile an application which targets android 4.0 and it will still run on 1.6 as long as you're writing code which doesn't depend on API which isn't present in 1.6.

Since there are a lot of changes since 1.6 there is a compatibility library which you can use. This library doesn't include the actionbar. Therefore you could use Actionbar Sherlock.

With these two libraries you should be able to write applications for 1.6 without having the pain to pass on new techniques.

If you still depend on leatest API features, you could request the API level on runtime and implement features for new devices only. You should avoid to ever use this API on old devices. You can compile it but it would crash on runtime if you do.

Upvotes: 2

Eric Cloninger
Eric Cloninger

Reputation: 2260

You typically build against the latest SDK that you plan to support and test against. This usually means "the current SDK" and is represented in the manifest as "targetSDKVersion". Another value called "minSDKVersion" that indicates how far back you support in terms of the API level. Google maintains the API consistency across past versions of the SDK, so it's usually in your best interest to test against what is current.

However, in newer SDKs, there may be things that cause your app to look or behave differently, so when you update the SDK, tools, and targetSDKVersion, you may have work to do to keep your app looking like it belongs.

Upvotes: 2

Related Questions