简体   繁体   中英

Android - different OS, different versions

我的问题如下:市场上可以有一个应用程序,但是当用户下载该应用程序时,根据用户所运行的操作系统,她会下载不同的文件-一个文件为2.2,另一个文件为2.1,第三个文件为1.5,依此类推。 ?

No, that is not possible. However, you can have your application respond differently to whatever OS level the device is running. Use android.os.Build to find out what version you are on, then use reflection or conditional class loading to route your behavior accordingly.

OR you can create different apps for each target OS version, name their packages differently (for instance com.example.16, com.example.20 com.example.21) and in each Android.xml specify minimum and maximum API level to the one you target. So the 2.1 version will have both mini and max API level set to 7. Then you publish all of them to the market under the same name.

When a user with an Android 2.1 searches for your app he will see only the one with the package name com.example.21 thus fixing your problem.

It seems appropriate to note that Swype's approach to problems like this is to download an "Installer" application first. (It's not from the Market, but it could just as well be)

Swype's installer uses a login and password to contact a Swype server, and download and install the appropriate .apk for your Android device.

Generally this approach is impractical to a smaller developer, as it requires server setup, etc. But it's another possibility that I thought I should mention.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM