Back to top

Google Mobile Services in Workspace (GMS)

This section covers how to use Google Mobile Services inside the Workspace container with the Knox SDK.

About GMS inside the Workspace

By default, GMS services are disabled inside the Workspace container.  You must enable them for many services to work. You do not have to enable any GMS services outside the container.

Enable core GMS packages inside the Workspace

Samsung includes core GMS packages in the Knox SDK, but they are not enabled by default. You can enable them using getApplicationPolicy as shown below.

EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance();
KnoxContainerManager kcm = ekm.getKnoxContainerManager(Context, containerID);
ApplicationPolicy appPolicy = kcm.getApplicationPolicy();
String[] gmsPackage = {"com.android.chrome",
"com.android.vending", "com.google.android.gm", "com.google.android.gms",
"com.google.android.gsf", "com.google.android.gsf.login", "com.google.android.apps.maps",
"com.google.android.setupwizard", "com.google.android.feedback", "com.google.android.street",
"com.google.android.backuptransport", "com.google.android.configupdater",
"com.google.android.syncadapters.contacts", "com.google.android.syncadapters.calendar",
"com.google.android.tts", "com.google.android.partnersetup" };

for (int i=0; i<gmsPackage.length; i++) {
appPolicy.setEnableApplication(gmsPackage[i]);
}
} catch (SecurityException e) {
Log.w(TAG, "SecurityException: " + e);
}

Enable Google Cloud Messaging Push service inside the Workspace

Enable the following packages for smooth testing:

  • com.android.gms
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance();
KnoxContainerManager kcm = ekm.getKnoxContainerManager(Context, containerID);
ApplicationPolicy appPolicy = kcm.getApplicationPolicy();

try {
    appPolicy.setEnableApplication("com.google.android.gms");

} catch (SecurityException e) {
        Log.w(TAG, "SecurityException: " + e);
}

Disable Google Cloud Messaging Push service

EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance();
KnoxContainerManager kcm = ekm.getKnoxContainerManager(Context, containerID);
ApplicationPolicy appPolicy = kcm.getApplicationPolicy();

try {
    appPolicy.setDisableApplication("com.google.android.gms");

} catch (SecurityException e) {
        Log.w(TAG, "SecurityException: " + e);
}

If you are using the new Knox 3.x container in Android O, you can’t disable Google Cloud Messaging Push Service with setDisableApplication by default. This restriction is because the com.google.android.gms package automatically runs as a device admin inside the container upon creation.

To disable this restriction do as follows.

  1. IT Admin (or user) must manually remove com.google.android.gms as the device owner from the device.
  2. Disable com.google.android.gms package with setDisableApplication.

Install Google Hangout

If these apps are installed on the personal side but not in the container, you may see some reduced functionality.

For example:

  • If Hangouts is set as the default message app on the personal side and is not installed in the container, notifications do not display in the container.
  • If Voice Search is not installed inside the container, you can’t use this function. For example, when you try Voice Search in Google Maps, a force app close occurs.
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance();
KnoxContainerManager kcm = ekm.getKnoxContainerManager(Context, containerID);
ApplicationPolicy appPolicy = kcm.getApplicationPolicy();
String hangoutPackageName= "com.google.android.talk";
try {
appPolicy.installApplication(hangoutPackageName);
} catch (SecurityException e) {
Log.w(TAG, "SecurityException: " + e);
}

Enable Google Voice

EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance();
KnoxContainerManager kcm = ekm.getKnoxContainerManager(Context, containerID);
ApplicationPolicy appPolicy = kcm.getApplicationPolicy();
String googleSearchPackageName = "com.google.android.googlequicksearchbox";
try {
appPolicy.installApplication(googleSearchPackageName);
} catch (SecurityException e) {
Log.w(TAG, "SecurityException: " + e);
}

Is this page helpful?