1

I am developing an android app in a situation where I would like:

  • Testers (not developers, not necessarily good with computers, but I do know their play store emails) to be able to quickly switch between a beta version and a stable version of the same app
  • To provide updates to both the stable version and the beta version through the play store
  • Restricted access to the beta version. The release version is already publicly available on the play store.

So far I have mostly focused on ways to get two versions of essentially the same app on an android device. I've already considered a few options, but I'd like advice as to how to proceed. I could:

  • Create a "new" app with beta appended to it's name, with a different icon to distinguish it to the testers, but mostly the same internals. It could be distributed as a closed alpha/internal test through the play store. I would like to avoid this, as it will make it more difficult for me to manage versions - when I want to promote beta to release, I would have to manually change the icon and the name of the app
  • Create a build flavor. I'm not entirely sure how capable build flavors are or how well-supported they are.
  • Use the google play store's closed alpha/internal test program. This is less than ideal because it takes considerable effort to opt-in/opt-out of testing programs. You have to go to a url, click a button, uninstall the app and reinstall the app.
  • Use an app like app cloner to clone the stable version and rename it, then distribute the beta through the play store. This is not ideal because it makes updating the release version require developer intervention.

note: When I say closed alpha and internal test, I mean google play closed alpha and internal test (accessible through the google developer console), not their more general definitions. When I say Beta, I mean the more general definition - a pre-release version.

Edit: upon following the advice on this post, I successfully installed two apps, but whenever trying to open one, I would get a picker dialog, like this information redacted to protect the identity of the app

Community
  • 1
  • 1
asky
  • 1,520
  • 12
  • 20
  • I ended up following the advice in this answer https://stackoverflow.com/a/32562324/6677437 – asky Oct 24 '18 at 19:27

2 Answers2

1

Google Play already gives you all what you need to distribute and alpha/beta/internal version at the same time as your prod version.

If I understand, your problem is that you want your testers to have both versions of the app at the same time on the same device. You can NOT accomplish that with the options you have considered. Even if you change the name and icon, the only important thing is the application id. If you don't change the application id, you can't have it installed twice. On the other hand, if you change the package name, it is considered a whole new app, so you would have to create a new app in Google Play.

I would recommend to use build variants (flavors) which by the way are totally supported. This way you could easily change the package name (and the app name, to make it easier to understand). Of course, as I mention before, you should create a new app in Google Play or distribute it in another way.

The gradle for the new variant should look similar to this in the app gradle:

buildTypes {
    release {
    ....
    }
    qa { //your new variant name
       applicationIdSuffix ".qa" //this will append a ".qa" to your app id
       versionNameSuffix "-qa" //this will append a "-qa" to your app name
       ...
    }
}
  • Your solution isn't properly changing the name my app displays under its icon on the home screen. For reference I have a `strings.xml` file with `foo`and in `AndroidManifest.xml`, I have `android:label="@string/app_name"`, which does change the name under the icon on the home screen. – asky Oct 10 '18 at 18:23
  • With the versionNameSuffix you should see "foo-qa" under your icon, ONLY when you build your app for that particular variant. – Rodrigo Arias Roberts Oct 11 '18 at 13:36
  • I am changing the variant and the name under my app's icon does not change. I know that I am changing the variant because applicationIdSuffix does work as expected. Any ideas? – asky Oct 11 '18 at 19:07
  • This answer was basically right, but `versionNameSuffix` never changed the app's name. I only got it to change with `resValue "string", "app_name", "AppName debug"` from the question linked in the question. Regardless I'll accept this as the answer. – asky Mar 28 '19 at 21:38
0

To address your last point and the screenshot, switch from using string-based Intents to using class based Intents within your app. By string-based Intents, I mean Intents constructed with public Intent (String action). For example

startActivity("com.myOrganization.NEXT_ACTIVITY");

(for these string intents to work they need to be declared in the manifest with an tag)

Replace them with the class-based constructor with function signature public Intent (Context packageContext, Class<?> cls). Like this:

startActivity(currentActivity.this, nextActivity.class)

String based intents are intended to be used for external services, for example opening a web browser to report a bug. In this case, you don't know what the java class name of the web browser is (i.e. it could be firefox.class or chrome.class). Withing your app, you know the class names of all the activities you want to start, so just use them. From the android documentation on the class-based Intent constructor

This provides a convenient way to create an intent that is intended to execute a hard-coded class name, rather than relying on the system to find an appropriate class for you

Using the class-based constructor has the additional advantage of making refactoring easier in Android Studio.

Note: You can still include intent-filters in the manifest to allow other apps to perform some action in your app

asky
  • 1,520
  • 12
  • 20