Is it possible to have multiple APK support based on country?

Mahdi Hijazi picture Mahdi Hijazi · Oct 9, 2011 · Viewed 8.1k times · Source

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?

Answer

yorkw picture yorkw · Dec 3, 2012

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.