Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What if I want to release an update with higher minSDK than the one on the market?

I have released an app on the market with minSDK set to 4 (Android 1.6) but now I want to release an update with features unavailable in 1.6 so I need a higher minSDK.

So, my question is: Will users running 1.6 be notified of this update?...and if yes will they be able to download/install it?

like image 774
Mircea Nistor Avatar asked Oct 11 '22 16:10

Mircea Nistor


1 Answers

No they shouldn't be notified of the update. The market will filter the application out all together and they will no longer be able to see it or receive updates.

If you want to add features that use a higher api level but not exclude user's of a lower api level you can use some reflection to enable this:

           public static Method getExternalFilesDir;        

            try {
                    Class<?> partypes[] = new Class[1];
        partypes[0] = String.class;
                    getExternalFilesDir = Context.class.getMethod("getExternalFilesDir", partypes);
            } catch (NoSuchMethodException e) {
                    Log.e(TAG, "getExternalFilesDir isn't available in this devices api");
            }

This piece of code is saying:

Within the Context.class have I got this method getExternalFilesDir (API level 9)

If so instantiate the variable getExternalFilesDir as a reflective call to this method else leave it as null.

Then later on you can simply do

     // If the user's device is API9 or above
     if(getExternalFilesDir != null){
       // Invoke is basically the same as doing Context.getExternalFilesDir(var1, var2);
       getExternalFilesDir.invoke(variable1, variable2);
     } else {
        // User cannot use this method do something else
     }

Hope that helps

like image 50
Blundell Avatar answered Oct 20 '22 15:10

Blundell