Skip to content Skip to sidebar Skip to footer

How To Publish An Almost Identical Version Of My Android App In A Different Location

I have released an android app downloadable in the UK, but I wish to release a (very slightly different) version of the app for the U.S. Currently I believe I need to do the follow

Solution 1:

Since you say you're just changing a couple of strings (we'll think of the URL as just a string, too), I would suggest the following:

  1. Create the resource directories res/values and res/values-en-rUS.

  2. In each of these, create a strings.xml resource file

  3. Define your default (UK specific) string values in the res/values directory, and your US specific string values in the res/values-en-rUS folder.

Then, to refer to these strings, simply use @string/my_string_name when referring to them from an XML document, or getResources().getString(R.string.my_string_name) when referring to them from code.

For more details on the types of resource qualifiers, check out this page, also for the list of qualified country codes you can use, see this page.

I'm sure anyone determined enough could change their region to US -- I'm honestly not sure offhand how the region is determined -- but for all intents and purposes this should do the trick without having to maintain two separate applications. I would just evaluate how critical it is that UK users be unable to access the US specific functions of the application, and with that in mind determine whether it is worth the maintenance of two applications.

EDIT Some more additional searching leads me to believe the region is locked into the build.prop file, which is not editable outside of rooting your device (i.e. it is not going to happen accidentally). That said, if it's still imperative that they have the correct option, I might suggest a popup dialog only on the first run of the application that confirms the locale with the user, saves it as a SharedPreference, and then choose your Strings programmatically based on that preference. That way you're still only maintaining one application, but you still have the flexibility of handling the two regions.

Solution 2:

This is correct. The Play Store goes off of two things for who can download and if they can update. The first is the packagename com.andya.myukapp -> com.andya.myusapp should work, as long as none of your existing customers are expecting to switch freely between the two (assuming it's a paid app)

Solution 3:

I eventually decided that the best policy was to use TelephonyManager to check the country of the Network.

TelephonyManagertm= (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
StringnetworkCountryCode= tm.getNetworkCountryIso();

If that failed, I got the locale.

Stringlocale= context.getResources().getConfiguration().locale.getCountry();

This would happen once at the start of the app. The results of this would then be saved and be configurable in the settings screen.

Post a Comment for "How To Publish An Almost Identical Version Of My Android App In A Different Location"