Android 4.0 应用程序可以与 Android 2.0 和 Android 3.0 设备配合使用吗?
我计划创建一个应用程序,供用户查看我目前正在制作的游戏的统计数据,但我的问题就像标题一样。我不确定Android 3.0、Android 2.0或更低版本的手机是否可以使用这些应用程序?如果没有,我该如何解决这个问题?我是否无法使用新的 API 功能(例如 NFC 等)?总而言之,如果我开始使用 Android 4.0 SDK 进行开发,所有 Android 手机都可以使用我的应用程序吗?
I plan on creating an application for users to view their stats of a game I am currently in the process of making but my question is like the title. I am not sure if phones with Android 3.0, Android 2.0 or lower can use the apps? If not, how would I work around this? Would I just not be able to use the new API features such as NFC etc? All in all, if I start developing with Android 4.0 SDK, will all android phones be able to use my app?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我对 Android 开发的理解是,如果您构建单个包,则可以根据最低公分母进行构建,并且它将在该版本上运行,并且很可能在任何较新的版本上运行。但反之则不然。
My understanding of android development, is that you can build against a lowest common denominator if you build a single package, and it will run on that version, and most likely any newer version. But not the other way around.
兼容性库(我们现在称之为支持库)没有使用任何特殊的魔法来实现这一点。您可以在运行时检查
Build.VERSION.SDK_INT
并使用类加载器保证来访问可用的新功能。一些示例如下: http://android-developers.blogspot.com/2010/07/how-to-have-your-cupcake-and-eat-it-too.html我们建议采取分级方法来支持不同的平台版本。在旧版本上提供更简单的 UI 版本,并在可用时将功能置于顶层。上面的链接提供了一些如何执行此操作的示例,我们将继续使用更多的
*Compat
类来扩展支持库,这些类在使用可能或可能的新功能时为您进行版本检查并非在您想要支持的所有设备上都可用。The compatibility library (which we're now just calling the support library) doesn't use any special magic to pull this off. You can check
Build.VERSION.SDK_INT
at runtime and use classloader guarantees to access newer functionality when it's available. Some examples are here: http://android-developers.blogspot.com/2010/07/how-to-have-your-cupcake-and-eat-it-too.htmlWe recommend taking a graduated approach to supporting different platform versions. Provide a simpler version of your UI on older versions and layer features on top as they become available. The link above gives some examples of how to do this, and we're going to continue expanding the support library with more
*Compat
classes that do the version checking for you when using newer features that may or may not be available on all devices you want to support.克里斯是对的。然而,这可能是有限的。如果您想灵活地在您的应用程序中使用 3.0 和 4.0 android 的功能(如果您运行的设备有这些功能),然后在没有的情况下优雅地回退,该怎么办?输入android 兼容性包。您可以使用非常旧的 api(一直追溯到 1.6)进行开发,并且仍然可以访问新的 api 功能。
Chris is right. However this can be limiting. What if you want to be flexible and use features of the 3.0 and 4.0 android in you app if the device you're running on has them and then gracefully fallback if they don't? Enter the android compatibility package. You can do development using really old api's (all the way back to 1.6) and still have access to new api features.