Publish a Android private app for multiple clients
Asked Answered
S

6

20

What we are dealing with

We have this app which we distribute to our clients in an offline fashion (i.e. not uploaded to Play store). The app flavour distributed to each client is almost identical with a bit of tweak here and there. All our clients share this app to their employees for usage. Basically this is an Enterprise App.

What's the problem

Recently one of our client started using a MDM (Mobility Device management) tool which blocks apps which are not downloaded from Google play. As obviously we got a request from our client to see if we can upload this app on Google play or not.

Important thing here is that we have over 100 clients and the package name of the app provided to each client is actually the same. So it's the same app with a bit of tweak here and there. If we go down the road of publishing the app to the play store, we might end up in a mayhem (we don't wanna upload 100 different apps to the play store - i.e. one for each client). We are doing some optimisation from our end so that multiple clients can use the same app (but we can't make all 100+ clients use the same app.).

What am I looking at ?

I started looking at Android For Work (AFW), Google private apps , Managed Google play and still digesting the stuffs. But to me it looked like just a secure way for enterprises to deploy/publish apps which can be downloaded only on specific devices and under a certain profile (which keeps things separate from user's personal apps and data in case they use the same phone for personal and work purpose).

What solution i am looking for ?

  1. To privately deploy an app (host it with Google or privately host but listed with Google play in both cases) and let my clients share this app with their employee.

  2. Each private app for each client should be on its own little private island. I want to distribute the app with the same package name to all my clients (From what I have read so far, this might not be possible with Google play. But I am hoping somebody can point out facts if I am missing something).

Samsara answered 3/8, 2017 at 23:50 Comment(11)
Seems to be answered here support.google.com/googleplay/work/answer/6145139?hl=enMercymerdith
And developer.android.com/distribute/marketing-tools/…Mercymerdith
Also, i know this is no solution but why did you gave every app the same package name?Chenay
@cricket_007 I will go through the links.Samsara
@MartinDeSimone As I mentioned in my post, it makes things easier for us. So we just have a single CI setup which generates the app. There are run-time flags in the app which decides how the app behaves for different clients. The run-time flags are configured on our server for different clients. Basically think there is a flag somewhere in the app which determines whether a button would be shown or not on a screen. And this flag is turned ON/OFF on the server and this info synched down.Samsara
Either way you do it, you'll need every client to enable Unknown installation sourcesMercymerdith
@cricket_007 That's not a problem. But can the app distributed to 2 different clients have the same package.Samsara
I have the same question as you, but I think the first question should be, "can you even publish the same private app to multiple Google Play private channels?" See: developers.google.com/android/work/play/custom-app-api/publish It says the package name must be unique to Google Play and not just the developer account while the title doesn't have to be. And see the first note in: developers.google.com/android/work/play/custom-app-api/… seems to use "custom apps" and "private apps" interchangeably, with custom apps targeting only a single enterprise.Micronesian
Still some confuse "But can the app distributed to 2 different clients have the same package." thats means same app U wanna share with different client. after client signin or somthing else server send data as per Client hirarchy . am i right ?Hombre
Is the main difference between clients configuration?Joggle
support.google.com/googleplay/work/answer/6145139?hl=en publish private app has not been doable for me. I am confused about multiple emailId used here for multiple purposes, I have play store creadancial from my company from which i have given admin rights to email1 and email2.Buffybuford
E
10

This is my solution:

Creating run-time dynamic app that get data and configs from back-end and render its views and data with its own Client Id.

You can create single app and upload to google play, but you should manage your clients by clientId that makes every app acts separated. This clientId is unique and generated per your clients. This solution have two sides. Android side and server side.

1 - Android side: Our app should have a baseUrl like this in Constants:

baseUrl = "http://yourCorporation.com/{clienId}/api/" 

And then all the services of All clients use the same url. clientId is the key point. The difference of you client app is clientId. For generating url of api-call you should do something like this:

Constant.ClientId = scannedQRCode;
url = baseUrl.replace("{client_id}",Contant.ClientId) + apiUrl ;

You must create QR code per your clients that should scanned in app first run. It is good to send QR code after registration to his/her (client of your Clients) email. This QR code have clientId. Therefor every clients have their own services and really works as separated islands, even if you want to change server address, you can put all baseUrl in QR code but this is not suggested, because you have to create server per clients and this is headache.

You can even handle config and UI elements of you app with calling a config api that returns a customConfigDto as json like this:

public class CustomConfigDto {

String colorPrimary ;
String colroPrimaryDark ;
String colorAccent ;
int tabCounts;

//and more...


public String getColorPrimary() {
    return colorPrimary;
}

public void setColorPrimary(String colorPrimary) {
    this.colorPrimary = colorPrimary;
}

public String getColroPrimaryDark() {
    return colroPrimaryDark;
}

public void setColroPrimaryDark(String colroPrimaryDark) {
    this.colroPrimaryDark = colroPrimaryDark;
}

public String getColorAccent() {
    return colorAccent;
}

public void setColorAccent(String colorAccent) {
    this.colorAccent = colorAccent;
}

public int getTabCounts() {
    return tabCounts;
}

public void setTabCounts(int tabCounts) {
    this.tabCounts = tabCounts;
}
}

And render your views by this configurations. All of this works separated per app by their clientId.

I prefer QR code because it is very handy and classy and fit in your case, however you can enter this clientId with many other ways. This is one of best free and simple QR code generating service, and this is one of best QR-code scanner library for android.

2 - Server Side: You have to handle step1 in server-side and it is very easy. You can have entity calls Client that all other entities have it. Because you should keep all of your data in one place but separated by your clients. You can also map APIs like this in Spring:

@RequestMapping(value = "http://yourCorporation.com/{clienId}/api/customers", method = RequestMethod.GET)
    Customers getCustomers(@PathVariable("clienId") Long clientId) {
        return customerService.findCustomerByClientId(clientId);
    }
Englert answered 15/8, 2017 at 8:18 Comment(0)
J
5

Based on what you've said, this sounds more like you can solve this with configuration management than sending each client completely separate APKs.

Google has a private channel, but based on the documentation it seems much more oriented towards having a single membership list (i.e. once you're granted access you have access to the entire private channel) rather than highly customized access (i.e. certain people have access to certain items in the channel).

An alternative that I suggest: have all clients download the same APK. Give each of them a client-specific "activation code" for your app. When the app starts for the first time, it calls a web service and passes it its activation code; on the server side, you use the Activation Code to identify the client and then return data on the correct configuration to the client. Then you can distribute the same APK to everyone on your private channel and configure it remotely once it's installed.

A major advantage of this scheme is that you can have multiple configurations for an organization. Just give the client a choice of several activation codes, each of which will give them a certain configuration. For example, if you have an app that's used by both dock workers and janitors (and I'm just throwing out an example here), you could give the dock workers one activation code and janitors a second activation code and you can then easily give them different configurations.

Joggle answered 11/8, 2017 at 19:20 Comment(1)
This approach is also suitable for clients located in various geographical locations e.g countries..Well thought, I recommend this approach.Acquisition
R
4

Google Play now allows a developer to publish an app privately to up to 20 Managed Play organizations (or enterprises). To do so (instructions copied from the help center):

  • Sign in to the Google Play Console.
  • Go to Pricing & Distribution > User programs > Managed Google Play.
  • Check the Turn on advanced managed Google Play features box.
  • Check the Privately target this app to a list of organizations box.
  • Click Choose Organizations.
  • For each organization that you want to publish the app to, enter the Organization ID and a description (or name) and click Add. You can enter up to 20 organizations per app.
Rev answered 20/11, 2017 at 16:48 Comment(2)
Please mention how to create an Organization IDRhondarhondda
Is the 20 organization limit documented by Google anywhere? Are there any other limitations to know when using a private channel such as a lack of alpha/beta releases?Micronesian
H
3

The good, long solution:

don't use the same package name for different apps. Create a multimodule project, set one module for the core, shared stuff, and add a module for each client where you can tweak what you need and configurate the package name dynamically based on build type. That way you can use the same package name for your CI server and everything else and have another package name when releasing the app.

The short workaround that may work:

Publish the app as a closed google play beta, and send invitations only to this client. That way he can distribute the app to his employees through play store and the other clients won't notice I can't assure it will work not knowing which MDM tool you are facing, but since beta channel apps don't require unknow origins permissions, you should be fine.

Haug answered 15/8, 2017 at 5:54 Comment(1)
The first option is a no go in my case as this is an existing project which has evolved in the last 5 years. So we are not thinking of re-organizing that. The second option is worth looking. Will update once I tried thatSamsara
K
1

If you want the same package name, you'll have to do something like what EJoshuaS suggested: manage the different configurations inside of one app version. You won't be able to have more than one app with the same package deployed on Google Play.

If you're open to having different packages, you could just change the package name in the Android Manifest for each one and release as a different app. You would need to change the package everywhere you import the R file and you would need to make sure that all class references in your Manifest include the entire class path (<activity android:name="[full.package].MainActivity"> rather than <activity android:name=".MainActivity">). This gets pretty confusing and is terrible in terms of configuration management, so it's not really a great solution in general, but it might work for you.

Krystalkrystalle answered 12/8, 2017 at 17:15 Comment(1)
You can change apk package name without changing java package names. You don't have to do anything about manifest file. Just create multiple productFlavor for each customer and set applicationId different for each of them.Materi
B
1

I started looking at Android For Work (AFW), Google private apps , Managed Google play and still digesting the stuffs.

This would probably be a good fit for AFW.

But to me it looked like just a secure way for enterprises to deploy/publish apps which can be downloaded only on specific devices and under a certain profile

That's what an MDM does, yes, but there's more to it. With Android for Work you also have Managed Configurations which let you pass in a configuration for the app. This can be used to change backend urls, etc.

It for sure supports your second requirement, but I know too little to be certain about the first. While you can privately host and rollout an app on Google Play for Work, I don't know about distributing it privately to multiple clients.

The obvious benefit of using this Google API is that you don't have to build anything yourself. Also most MDMs support those Android for Work APIs, so that a domain admin can buy the app in bulk and distribute them to the employees. Have a look at the AppConfig Community which shows MDM Providers that incorporated those APIs and best practices.

Whatever you decide, you should definitely have a good look at Android for Work as what you are describing is exactly what it is intended for. The initial setup is a pain and there is way too little information about how it all works and plays together, but spending a few days trying to figure it out might be better than just building your own managed solution which you then will have to maintain too.

Brunhild answered 12/8, 2017 at 17:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.