是否有可能基于国家有多个APK支持? [英] Is it possible to have multiple APK support based on country?

查看:82
本文介绍了是否有可能基于国家有多个APK支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一款免费和定价产品的应用程序,我需要为我的应用程序创建两个APK,并在支持该应用程序的国家/地区显示支持应用程序内帐单的应用程序,并显示同一应用程序的另一个APK, t支持应用内结算(它只有免费产品)在不支持它的国家/地区。



我可以使用Android Market多种APK支持功能做到这一点?如果没有,是否有任何可行的建议,而不是创建两个单独的应用程序?

解决方案

多个APK功能AFAIK不支持过滤国家至少在当前版本中。查看支持的过滤器多个APK的规则以获取更多详细信息。



如果你打算建立两个apks。除了使用多个APK功能(即使它在未来版本中支持过滤国家/地区),它也可以作为两个独立的应用程序(您可以在开发人员控制台中为每个应用程序区分并设置可用的国家/地区)进行更简单易用的维护。人们用来避免重复代码的正常方式是使用Android库项目。



如果您只想为所有情况构建和发布单个apk,一个可行的解决方案可以是在项目资源中维护一个受支持的国家列表,并添加一些条件分支来启用/禁用基于国家/地区列表的应用内帐单代码,并在运行时用一些UI警告确认用户,如:

  if(isInSupportedCountryList()){
setInAppBillingOn();
} else {
setInAppBillingOff();

code


$ b

正如你所看到的,这需要(甚至不是必需的)更新/每次新的国家都被Google支持或删除时发布。

I have an application that has free and priced products, I need to create two APKs for my application and show the application that supports In-App Billing in the countries that support it and show another APK of the same application that doesn't support In-App Billing (It has only the free products) in the countries that don't support it.

Can I use the Android Market Multiple APK Support feature to achieve this? If not, is there any feasible suggestions other than creating tow separate applications?

解决方案

Multiple APK feature AFAIK does not support filtering country at least in the current release. Check out Supported filters and Rules for multiple APKs for more details.

If you are going to build two apks anyway. It is much simpler and easy-maintainable to publish them as two standalone application (where you can differ and set available country for each in developer console), other than using Multiple APK feature (says even it supports filtering country in the future release). A normal way people used to avoid duplicate code is using Android Library Project.

If you only want to build and publish a single apk for all cases. a feasible solution could be maintain a supported country list in project resource and add some conditional branch to enable/disable in-app billing code based on the country list, and acknowledge user with some UI warning at runtime, something like:

if (isInSupportedCountryList()) {
  setInAppBillingOn();
} else {
  setInAppBillingOff();
}

As you can see, this needs (even not necessary) updates/re-publish every time new countries are supporting or removed by Google.

这篇关于是否有可能基于国家有多个APK支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆