开发者

Android - different OS, different versions

开发者 https://www.devze.com 2023-01-24 08:28 出处:网络
My question is the following: can I have one application on the market, but 开发者_运维百科when the user downloads it, depending on what OS the user is running, she downloads different file - one file

My question is the following: can I have one application on the market, but 开发者_运维百科when the user downloads it, depending on what OS the user is running, she downloads different file - one file for 2.2, other for 2.1, third for 1.5, etc?


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.

0

精彩评论

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

关注公众号