Simone
Simone

Reputation: 1337

Update an existing app to require a newer API version

I'm a beginner as to Android app development, and I'm trying to roll out some small projects to get a grip of how things works in this development realm. I'm going to start with a very basic app, that is mostly for personal use and won't use any advanced features or sensors. That's why I think I can safely decide to set the minimum SDK to something as old as 2.2 (earliest I see in Android Studio).

However, potential future improvements of the app may involve features not present in such early versions. To add those features, I suppose I would have to release a new version with a higher minimum API level requirement.

How could I deal with this? Could I change the minimum API level for future versions? Should I implement the app so that it flexibly supports different feature sets based on the OS version?

Upvotes: 1

Views: 783

Answers (2)

danny117
danny117

Reputation: 5651

The min version can be changed higher or lower on a subsequent release of your app. Idk if there is a force update for apps but you can roll your own with a custom webservice on yoursite.com that returns the current app version number which you would compare with Build.VERSION.SDKINT

You can also code for older versions to skip the new features. Below I'm coding to handle a method that was deprecated and renamed.

if (mapView.getViewTreeObserver().isAlive()) {
                mapView.getViewTreeObserver().addOnGlobalLayoutListener(
                        new OnGlobalLayoutListener() {

                            @SuppressWarnings("deprecation")
                            // We use the new method when supported
                            @SuppressLint("NewApi")
                            // We check which build version we are using.
                            @Override
                            public void onGlobalLayout() {

                                if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
                                    mapView.getViewTreeObserver()
                                            .removeGlobalOnLayoutListener(this);
                                } else {
                                    mapView.getViewTreeObserver()
                                            .removeOnGlobalLayoutListener(this);
                                }

...

TIPS for first app: (these are simple intents) Make a contact me option/button that sends an email to you. Make a rate me button/option on your app that takes users to the play store for your app.

Upvotes: 1

Roberto Betancourt
Roberto Betancourt

Reputation: 2505

I really wouldn't recommend to setup you minimum version all the way back to 2.2 unless is for strictly educational purposes as you're going to run into many annoying fragmentation issues between versions.

Nowadays, setting a minimum version of 4.0 or 4.1 will cover your about 90% of the android market.

Upvotes: 0

Related Questions