开发者

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

开发者 https://www.devze.com 2023-02-10 11:27 出处:网络
I have released an a开发者_Go百科pp 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.

I have released an a开发者_Go百科pp 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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消