【问题标题】:What if I want to release an update with higher minSDK than the one on the market?如果我想发布一个 minSDK 比市场上更高的更新怎么办?
【发布时间】:2011-02-11 12:30:21
【问题描述】:

我在市场上发布了an appminSDK 设置为 4(Android 1.6),但现在我想发布一个 更新,其中包含 1.6 中不可用的功能,所以我需要更高的minSDK

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

【问题讨论】:

    标签: android sdk google-play


    【解决方案1】:

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

    如果您想添加使用较高 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");
                }
    

    这段代码在说:

    在 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
         }
    

    希望有帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-08-07
      • 1970-01-01
      • 1970-01-01
      • 2013-03-20
      • 2012-01-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多