如果我想以比市场上更高的minSDK发布更新,该怎么办?

Mir*_*tor 5 sdk android google-play

我已经在市场上发布了一个应用程序,其中minSDK设置为4(Android 1.6),但现在我想发布一个更新,其功能在1.6中不可用,所以我需要更高的minSDK.

所以,我的问题是:运行1.6的用户是否会收到此更新的通知?...如果是,他们是否可以下载/安装它?

Blu*_*ell 4

不,他们不应该收到更新通知。市场会将应用程序全部过滤掉,他们将无法再看到它或接收更新。

如果您想添加使用较高 api 级别的功能,但不排除较低 api 级别的用户,您可以使用一些反射来启用此功能:

           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");
            }
Run Code Online (Sandbox Code Playgroud)

这段代码说的是:

在 Context.class 中我有这个方法 getExternalFilesDir(API 级别 9)

如果是这样,请将变量 getExternalFilesDir 实例化为对此方法的反射调用,否则将其保留为 null。

然后你可以简单地做

     // 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
     }
Run Code Online (Sandbox Code Playgroud)

希望有帮助