Since: API level 13
public class

EnterpriseBillingPolicy

extends Object
java.lang.Object
   ↳ com.samsung.android.knox.net.billing.EnterpriseBillingPolicy

Deprecated in API level 33
NOTE: This Class is not available since Android 12.

Class Overview

This class provides APIs to set up and manage Enterprise Billing on KNOX devices.

KNOX enterprise billing separates the bill generation for personal and enterprise data usage. In Dual-APN approach, two different APNs (Access Point Name) are used. This feature assumes that the network is capable of multiple simultaneous data connections on these 2 APNs. One connection is made using default APN and used to route personal mode traffic, while another connection is made using enterprise APN and used to route the traffic from container apps. At network side the Operator can meter the two connections and generate separate bills for IMSI.

The EnterpriseBilling APIs are invoked by MDM which creates and owns the container on KNOX Device. To setup split billing, MDM should first create a EnterpriseBillingProfile and then bind one or more containers to the profile.

Since
API level 13
KNOX 2.2

Summary

Constants
String ALL_APPS_IN_SCOPE Deprecated in API level 33
NOTE: This Variable is not available since Android 12.
Public Methods
boolean activateProfile(String ebProfileName, boolean activate)
Deprecated in API level 33
NOTE: This API is not available since Android 12.
boolean allowRoaming(String ebProfileName, boolean allow)
Deprecated in API level 33
NOTE: This API is not available since Android 12.
boolean bindAppsToProfile(String ebProfileName, List<String> packageList)
Deprecated in API level 33
NOTE: This API is not available since Android 12.
boolean bindVpnToProfile(String ebProfileName, String vpnProfileName, String vpnPackageName)
Deprecated in API level 33
NOTE: This API is not available since Android 12.
boolean createProfile(EnterpriseBillingProfile ebProfile)
Deprecated in API level 33
NOTE: This API is not available since Android 12.
List<String> getAppsBoundToProfile(String ebProfileName)
Deprecated in API level 33
NOTE: This API is not available since Android 12.
List<String> getAvailableProfiles()
Deprecated in API level 33
NOTE: This API is not available since Android 12.
EnterpriseBillingProfile getBoundedProfile(String packageName)
Deprecated in API level 33
NOTE: This API is not available since Android 12.
EnterpriseBillingProfile getProfileDetails(String ebProfileName)
Deprecated in API level 33
NOTE: This API is not available since Android 12.
boolean isProfileActive(String ebProfileName)
Deprecated in API level 33
NOTE: This API is not available since Android 12.
boolean isRoamingAllowed(String ebProfileName)
Deprecated in API level 33
NOTE: This API is not available since Android 12.
boolean removeProfile(String ebProfileName)
Deprecated in API level 33
NOTE: This API is not available since Android 12.
boolean unbindAppsFromProfile(String ebProfileName, List<String> packageList)
Deprecated in API level 33
NOTE: This API is not available since Android 12.
boolean unbindVpnFromProfile(String ebProfileName, String vpnProfileName)
Deprecated in API level 33
NOTE: This API is not available since Android 12.
boolean updateProfile(EnterpriseBillingProfile ebProfile)
Deprecated in API level 33
NOTE: This API is not available since Android 12.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String ALL_APPS_IN_SCOPE

Since: API level 13

Deprecated in API level 33
NOTE: This Variable is not available since Android 12.

This is to refer complete scope during bind & unbind operation

Since
API level 13
KNOX 2.2
Constant Value: "*"

Public Methods

public boolean activateProfile (String ebProfileName, boolean activate)

Since: API level 13

Deprecated in API level 33
NOTE: This API is not available since Android 12.

API to set policy which activates or deactivates enterprise data connection for a particular profile.

On activate, enterprise data connection is made and containers/apps bound to this profile are routed over this connection, while personal apps work on default connection.
On deactivate, enterprise data connection is disconnected. All apps in the device will work on default connection.

Parameters
ebProfileName the profile name
activate true to activate, false to deactivate
Returns
  • true if setting is updated, false in case of any error
Throws
SecurityException If caller does not have required permissions.
Usage

Admin can make use of this API to activate or deactivate enterprise data connection for a particular profile

            EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
            try {
                EnterpriseBillingPolicy policy = ekm.getEnterpriseBillingPolicy();
                if(policy != null) {
                    //activate will be either true or false
                    bool retVal = policy.activateProfile(ebProfileName, activate);
                    if(retVal==true) {
                        // activated / deactivated successfully
                    } else {
                        // The profile doesn't exists
                    }
                }
            } catch (SecurityException e) {
              Log.w(TAG, "Exception" + e);
            }
 
 
For Container:
 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
            EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
            KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
            try {
                EnterpriseBillingPolicy policy = kcm.getEnterpriseBillingPolicy();
                if(policy != null) {
                    //activate will be either true or false
                    bool retVal = policy.activateProfile(ebProfileName, activate);
                    if(retVal==true) {
                        // activated / deactivated successfully
                    } else {
                        // The profile doesn't exists
                    }
                }
            } catch (SecurityException e) {
              Log.w(TAG, "Exception" + e);
            }
 
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EBILLING" permission which has a protection level of signature.

Since
API level 13
KNOX 2.2
Multiuser Environment
User Scope

public boolean allowRoaming (String ebProfileName, boolean allow)

Since: API level 13

Deprecated in API level 33
NOTE: This API is not available since Android 12.

API to set policy which allows or disallows Enterprise connection while device is in roaming network.

If allowed, enterprise data connection is brought up and container traffic is routed over it.
If disallowed, container traffic uses the default connection (which depends on User setting for Roaming Data)

Parameters
ebProfileName the profile name
allow true if roaming should be allowed, false if roaming should be disallowed
Returns
  • true if success, false in case of any error
Throws
SecurityException If caller does not have required permissions.
Usage

Admin can make use of this API to allow or disallow the Enterprise Billing when in roaming

            EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
            try {
                EnterpriseBillingPolicy policy = ekm.getEnterpriseBillingPolicy();
                if(policy != null) {
                    // allow will be either true or false
                    policy.allowRoaming(ebProfileName, allow);
                }
            } catch (SecurityException e) {
              Log.w(TAG, "Exception" + e);
            }

 
For Container:
 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
            EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
            KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
            try {
                EnterpriseBillingPolicy policy = kcm.getEnterpriseBillingPolicy();
                if(policy != null) {
                    // allow will be either true or false
                    policy.allowRoaming(ebProfileName, allow);
                }
            } catch (SecurityException e) {
              Log.w(TAG, "Exception" + e);
            }

 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EBILLING" permission which has a protection level of signature.

Since
API level 13
KNOX 2.2
Multiuser Environment
User Scope

public boolean bindAppsToProfile (String ebProfileName, List<String> packageList)

Since: API level 13

Deprecated in API level 33
NOTE: This API is not available since Android 12.

API to bind the list of applications to a billing profile and activates it, if not already done.

During activation, device pre-conditions are checked and a new data connection is made on enterprise APN set in the profile and the data from these applications will be routed over the enterprise data connection.

Parameters
ebProfileName the profile name
packageList list of packages to be bound to profile
Returns
  • true if operation is successful, else false
Throws
SecurityException If caller does not have required permissions.
Usage

Method of binding the list of applications at owner user space(outside container) to the profile and EnterpriseBilling is enabled for that application list

             EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
             try {
                 EnterpriseBillingPolicy policy = ekm.getEnterpriseBillingPolicy();
                 List packageList = new ArrayList(); //after this add the required packages
                 if(policy != null) {
                     boolean retVal = policy.bindAppsToProfile(ebProfileName,packageList);  
                     if(retVal==true) {
                         // For given personal application package list Enterprise Billing is enabled
                     } else {
                         // operation failed
                     }
                 }
             } catch (SecurityException e) {
               Log.w(TAG, "Exception" + e);
             }
 
For Container:

Method of binding the container to the profile and EnterpriseBilling is enabled for that container

 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
             EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
             KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
             try {
                 EnterpriseBillingPolicy policy = kcm.getEnterpriseBillingPolicy();
                 List packageList = new ArrayList();
                 packageList = packageList.add(ALL_APPS_IN_SCOPE); //For adding entire container to SplitBilling, * denotes all
                 if(policy != null) {
                     boolean retVal = policy.bindAppsToProfile(ebProfileName,packageList);  
                     if(retVal==true) {
                         // For current container Enterprise Billing is enabled
                     } else {
                         // operation failed
                     }
                 }
             } catch (SecurityException e) {
               Log.w(TAG, "Exception" + e);
             }
  

This Api for container application works since knox 2.4 only Method of binding the list of applications at container space(inside container) to the profile and EnterpriseBilling is enabled for that application list

 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
             EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
             KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
             try {
                 EnterpriseBillingPolicy policy = kcm.getEnterpriseBillingPolicy();
                 List packageList = new ArrayList();
                 //Add Inside Container Applications to this packageList
                 if(policy != null) {
                     boolean retVal = policy.bindAppsToProfile(ebProfileName,packageList);  
                     if(retVal==true) {
                         // For given container application package list Enterprise Billing is enabled
                     } else {
                         // operation failed
                     }
                 }
             } catch (SecurityException e) {
               Log.w(TAG, "Exception" + e);
             }
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EBILLING" permission which has a protection level of signature.

Since
API level 13
KNOX 2.2
Multiuser Environment
User Scope

public boolean bindVpnToProfile (String ebProfileName, String vpnProfileName, String vpnPackageName)

Since: API level 13

Deprecated in API level 33
NOTE: This API is not available since Android 12.

API to bind VPN connection to the billing profile.

After invoking this API, the data traffic corresponding to this VPN connection (profile) will be routed over the Enterprise data connection.
VPN profile can be based on either com.sec.enterprise.knox.EnterprisePremiumVpnPolicy or com.sec.enterprise.knox.GenericVpnPolicy

Parameters
ebProfileName Billing profile name
vpnProfileName VPN profile name ,may or may not be available at this time
vpnPackageName Package name of VPN engine, may or may not be available at this time
Returns
  • true if successful, false in case of error
Throws
SecurityException If caller does not have required permissions.
Usage

Call this API with billing profile name, vpn profile name and VPN client package

            EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
            try {
                EnterpriseBillingPolicy policy = ekm.getEnterpriseBillingPolicy();
                if(policy != null) {
                    boolean retVal = policy.bindVpnToProfile(ebProfileName, vpnProfileName, vpnPackageName);
                    if(retVal==true) {
                        // VPN engine details are successfully added to given EnterpriseBilling profile
                    } else {
                        // Operation failed
                    }
                }
            } catch (SecurityException e) {
              Log.w(TAG, "Exception" + e);
            }
 
 
For Container:
      
 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
            EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
            KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
            try {
                EnterpriseBillingPolicy policy = kcm.getEnterpriseBillingPolicy();
                if(policy != null) {
                    boolean retVal = policy.bindVpnToProfile(ebProfileName, vpnProfileName, vpnPackageName);
                    if(retVal==true) {
                        // VPN engine details are successfully added to given EnterpriseBilling profile
                    } else {
                        // Operation failed
                    }
                }
            } catch (SecurityException e) {
              Log.w(TAG, "Exception" + e);
            }
 
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EBILLING" permission which has a protection level of signature.

Since
API level 13
KNOX 2.2
Multiuser Environment
User Scope

public boolean createProfile (EnterpriseBillingProfile ebProfile)

Since: API level 13

Deprecated in API level 33
NOTE: This API is not available since Android 12.

API to create a new billing profile for this Admin.

Parameters
ebProfile to be added into device
Returns
  • true if operation is accepted successfully, false if profile addition has failed
Throws
SecurityException If caller does not have required permissions.
Usage

The first step in using EnterpriseBilling feature is to create profile. This profile information like APN details (apn, mcc,mnc).

Profile detail is used while activating the EnterpriseBilling for a container or application.
The restriction on this API is that profile name has to be unique in device. It is recommended to prepend profile name with enterprise name which helps in creating unique profile name.

          EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
          try {
              EnterpriseBillingPolicy policy = ekm.getEnterpriseBillingPolicy();
              if(policy != null) {
                  EnterpriseBillingProfile ebProfile = new EnterpriseBillingProfile(profileName);
                  ebProfile.addApnsToProfile(apns);// adds a list of EnterpriseApn
                  if(ebProfile != null) {
                      boolean retVal = policy.createProfile(ebProfile);
                      if(retVal==true) {
                          // ebProfile is created successfully
                      } else {
                          // ebProfile creation has failed
                      }
                  }
              }
          }
          catch (SecurityException e) {
              Log.w(TAG, "Exception" + e);
          }
 
For Container:
 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
          EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
          KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
          try {
              EnterpriseBillingPolicy policy = kcm.getEnterpriseBillingPolicy();
              if(policy != null) {
                  EnterpriseBillingProfile ebProfile = new EnterpriseBillingProfile(profileName);
                  ebProfile.addApnsToProfile(apns);// adds a list of EnterpriseApn
                  if(ebProfile != null) {
                      boolean retVal = policy.createProfile(ebProfile);
                      if(retVal==true) {
                          // ebProfile is created successfully
                      } else {
                          // ebProfile creation has failed
                      }
                  }
              }
          }
          catch (SecurityException e) {
              Log.w(TAG, "Exception" + e);
          }
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EBILLING" permission which has a protection level of signature.

Since
API level 13
KNOX 2.2
Multiuser Environment
User Scope

public List<String> getAppsBoundToProfile (String ebProfileName)

Since: API level 13

Deprecated in API level 33
NOTE: This API is not available since Android 12.

API to get the list of applications which are bound to given profile.

Parameters
ebProfileName the profile name
Returns
  • List of package names corresponding to applications outside container using this profile, null if no app is assigned
Throws
SecurityException If caller does not have required permissions.
Usage

Call this API with profile name for which you want to fetch the assigned applications

             EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
             try {
                 EnterpriseBillingPolicy policy = ekm.getEnterpriseBillingPolicy();
                 if(policy != null) {
                     List packages = null;
                     packages=policy.getAppsBoundToProfile(ebProfileName);  
                     if(packages!=null) {
                         // Application package list is fetched
                     } else {
                         // no application found assigned to given profile
                     }
                 }
             } catch (SecurityException e) {
               Log.w(TAG, "Exception" + e);
             }


 
For Container:
 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
             EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
             KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
             try {
                 EnterpriseBillingPolicy policy = kcm.getEnterpriseBillingPolicy();
                 if(policy != null) {
                     List packages = null;
                     packages=policy.getAppsBoundToProfile(ebProfileName);  
                     if(packages!=null && packages.contains(ALL_APPS_IN_SCOPE)) {
                         // current container is added to Enterprise Billing
                     } else {
                         // current container is not added to Enterprise Billing
                     }
                 }
             } catch (SecurityException e) {
               Log.w(TAG, "Exception" + e);
             }


 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EBILLING" permission which has a protection level of signature.

Since
API level 13
KNOX 2.2
Multiuser Environment
User Scope

public List<String> getAvailableProfiles ()

Since: API level 13

Deprecated in API level 33
NOTE: This API is not available since Android 12.

API to get the list of billing profiles created by the calling admin.

Returns
  • list of billing profiles created by calling admin or null if no profiles were created
Throws
SecurityException If caller does not have required permissions.
Usage

Invoke the API to get the list of available profiles created earlier

             EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
             EnterpriseBillingPolicy policy = ekm.getEnterpriseBillingPolicy();
             try {
                List profileList = null;
                profileList = policy.getAvailableProfiles();
             } catch (SecurityException e) {
                Log.w(TAG, "Exception" + e);
             }
 
For Container:
 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
             EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
             KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
             EnterpriseBillingPolicy policy = kcm.getEnterpriseBillingPolicy();
             try {
                List profileList = null;
                profileList = policy.getAvailableProfiles();
             } catch (SecurityException e) {
                Log.w(TAG, "Exception" + e);
             }
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EBILLING" permission which has a protection level of signature.

Since
API level 13
KNOX 2.2
Multiuser Environment
User Scope

public EnterpriseBillingProfile getBoundedProfile (String packageName)

Since: API level 13

Deprecated in API level 33
NOTE: This API is not available since Android 12.

API to get the billing profile to which the application/container is currently bound

Parameters
packageName the package name
Returns
  • profile set to application/container, null in case of error
Throws
SecurityException If caller does not have required permissions.
Usage

Method of getting the EnterpriseBilling Profile for User Space(Outside Container) Application

             EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
             try {
                EnterpriseBillingPolicy policy = ekm.getEnterpriseBillingPolicy();
                 if(policy != null) {
                EnterpriseBillingProfile ebProfile = policy.getBoundedProfile(packageName);  
                 if(ebProfile!=null) {
                    // profile detail is fetched
                 } else {
                    // no corresponding profile detail is found
                 }
                }
             } catch (SecurityException e) {
                Log.w(TAG, "Exception" + e);
             }  
 
 
For Container:

Method of getting the EnterpriseBilling Profile for Container(Use * for Container)

 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
             EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
             KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
             try {
                EnterpriseBillingPolicy policy = kcm.getEnterpriseBillingPolicy();
                 if(policy != null) {
                 //packageName =  ALL_APPS_IN_SCOPE for all
                EnterpriseBillingProfile ebProfile = policy.getBoundedProfile(packageName);  
                 if(ebProfile!=null) {
                    // profile detail is fetched
                 } else {
                    // no corresponding profile detail is found
                 }
                }
             } catch (SecurityException e) {
                Log.w(TAG, "Exception" + e);
             }  
 
 

This Api for container application works since knox 2.4 only Method of getting the EnterpriseBilling Profile for Container Space(Inside Container) Application

 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
             EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
             KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
             try {
                EnterpriseBillingPolicy policy = kcm.getEnterpriseBillingPolicy();
                 if(policy != null) {
                 //packageName = Inside Container Application
                EnterpriseBillingProfile ebProfile = policy.getBoundedProfile(packageName);  
                 if(ebProfile!=null) {
                    // profile detail is fetched
                 } else {
                    // no corresponding profile detail is found
                 }
                }
             } catch (SecurityException e) {
                Log.w(TAG, "Exception" + e);
             }  
 
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EBILLING" permission which has a protection level of signature.

Since
API level 13
KNOX 2.2
Multiuser Environment
User Scope

public EnterpriseBillingProfile getProfileDetails (String ebProfileName)

Since: API level 13

Deprecated in API level 33
NOTE: This API is not available since Android 12.

API to get the details of an existing profile.

Parameters
ebProfileName the profile name
Returns
Throws
SecurityException If caller does not have required permissions.
Usage

This API will return the profile detail corresponding to given profile Name

             EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
             try {
                EnterpriseBillingPolicy policy = ekm.getEnterpriseBillingPolicy();
                 if(policy != null) {
                EnterpriseBillingProfile ebProfile = policy.getProfileDetails(ebProfileName); 
                 if(ebProfile!=null) {
                    // profile successfully retrieved
                 } else {
                    // operation failed
                 }
                }
             } catch (SecurityException e) {
                Log.w(TAG, "Exception" + e);
             }
 
 
For Container:
 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
             EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
             KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
             try {
                EnterpriseBillingPolicy policy = kcm.getEnterpriseBillingPolicy();
                 if(policy != null) {
                EnterpriseBillingProfile ebProfile = policy.getProfileDetails(ebProfileName); 
                 if(ebProfile!=null) {
                    // profile successfully retrieved
                 } else {
                    // operation failed
                 }
                }
             } catch (SecurityException e) {
                Log.w(TAG, "Exception" + e);
             }
 
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EBILLING" permission which has a protection level of signature.

Since
API level 13
KNOX 2.2
Multiuser Environment
User Scope

public boolean isProfileActive (String ebProfileName)

Since: API level 13

Deprecated in API level 33
NOTE: This API is not available since Android 12.

API to check whether Enterprise connection is activated for a profile.

Parameters
ebProfileName the billing profile name
Returns
  • true if is activated, false if deactivated or error
Throws
SecurityException If caller does not have required permissions.
Usage

Admin can make use of this API to check whether Enterprise connection is activated for a profile

            EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
            try {
                EnterpriseBillingPolicy policy = ekm.getEnterpriseBillingPolicy();
                if(policy != null) {
                    bool retVal = policy.isProfileActive(ebProfileName);  
                    if(retVal==true) {
                        // Current profile is active
                    } else {
                        // Current profile is inactive
                    }
                }
            } catch (SecurityException e) {
              Log.w(TAG, "Exception" + e);
            }
 
 
For Container:
 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
            EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
            KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
            try {
                EnterpriseBillingPolicy policy = kcm.getEnterpriseBillingPolicy();
                if(policy != null) {
                    bool retVal = policy.isProfileActive(ebProfileName);  
                    if(retVal==true) {
                        // Current profile is active
                    } else {
                        // Current profile is inactive
                    }
                }
            } catch (SecurityException e) {
              Log.w(TAG, "Exception" + e);
            }
 
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EBILLING" permission which has a protection level of signature.

Since
API level 13
KNOX 2.2
Multiuser Environment
User Scope

public boolean isRoamingAllowed (String ebProfileName)

Since: API level 13

Deprecated in API level 33
NOTE: This API is not available since Android 12.

API to check whether Roaming is allowed or disallowed for given billing profile

Parameters
ebProfileName the profile name
Returns
  • true if is roaming allowed, false if not
Throws
SecurityException If caller does not have required permissions.
Usage

Admin can make use of this API to check whether Enterprise Roaming is allowed or disallowed for given profile name

            EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
            try {
                EnterpriseBillingPolicy policy = ekm.getEnterpriseBillingPolicy();
                if(policy != null) {
                    boolean retVal = policy.isRoamingAllowed(ebProfileName);  
                    if(retVal==true) {
                        // Roaming is enabled for given billing profile
                    } else {
                        // Roaming is not enabled for given billing profile
                    }
                }
            } catch (SecurityException e) {
              Log.w(TAG, "Exception" + e);
            }
 
 
For Container:
 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
            EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
            KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
            try {
                EnterpriseBillingPolicy policy = kcm.getEnterpriseBillingPolicy();
                if(policy != null) {
                    boolean retVal = policy.isRoamingAllowed(ebProfileName);  
                    if(retVal==true) {
                        // Roaming is enabled for given billing profile
                    } else {
                        // Roaming is not enabled for given billing profile
                    }
                }
            } catch (SecurityException e) {
              Log.w(TAG, "Exception" + e);
            }
 
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EBILLING" permission which has a protection level of signature.

Since
API level 13
KNOX 2.2
Multiuser Environment
User Scope

public boolean removeProfile (String ebProfileName)

Since: API level 13

Deprecated in API level 33
NOTE: This API is not available since Android 12.

API to remove a billing profile from device.

Parameters
ebProfileName the profile name
Returns
  • true if operation is accepted successfully, false if profile removal has failed
Throws
SecurityException If caller does not have required permissions.
Usage

Call this API to remove an already created profile.

             EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
             try {
                 EnterpriseBillingPolicy policy = ekm.getEnterpriseBillingPolicy();
                 if(policy != null) {
                     boolean retVal = policy.removeProfile(ebProfileName); 
                     if(retVal==true) {
                         // profile removed successfully
                     } else {
                         // profile removal has failed
                     }
                 }
             } catch (SecurityException e) {
               Log.w(TAG, "Exception" + e);
             }
 
For Container:
 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
             EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
             KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID)
             try {
                 EnterpriseBillingPolicy policy = kcm.getEnterpriseBillingPolicy();
                 if(policy != null) {
                     boolean retVal = policy.removeProfile(ebProfileName); 
                     if(retVal==true) {
                         // profile removed successfully
                     } else {
                         // profile removal has failed
                     }
                 }
             } catch (SecurityException e) {
               Log.w(TAG, "Exception" + e);
             }
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EBILLING" permission which has a protection level of signature.

Since
API level 13
KNOX 2.2
Multiuser Environment
User Scope

public boolean unbindAppsFromProfile (String ebProfileName, List<String> packageList)

Since: API level 13

Deprecated in API level 33
NOTE: This API is not available since Android 12.

API to unbind the list of application from billing profile and deactivates it, if no more containers or applications are bound to the profile.

Parameters
ebProfileName the profile name
packageList list of packages to be un-bound from profile
Returns
  • true if operation is successful, else false
Throws
SecurityException If caller does not have required permissions.
Usage

Method of unbinding the list of applications at owner user space (outside container) from the profile and EnterpriseBilling is disabled for that application list

             EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
             List packageList = new ArrayList();
             try {
                 EnterpriseBillingPolicy policy = ekm.getEnterpriseBillingPolicy();
                 if(policy != null) {
                     boolean retVal = policy.unbindAppsFomProfile(packageList);  
                     if(retVal==true) {
                         // For given package list Enterprise Billing is disabled
                     } else {
                         // operation failed
                     }
                 }
             } catch (SecurityException e) {
               Log.w(TAG, "Exception" + e);
             }
 
For Container:

Method of unbinding the container from the profile and EnterpriseBilling is disabled for that container

 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
            EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
            KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
            List packageList = new ArrayList();
            packageList = packageList.add(ALL_APPS_IN_SCOPE); //For removing entire container to SplitBilling, * denotes all
             try {
                 EnterpriseBillingPolicy policy = kcm.getEnterpriseBillingPolicy();
                 if(policy != null) {
                     boolean retVal = policy.unbindAppsFomProfile(packageList);  
                     if(retVal==true) {
                         // For given container Enterprise Billing is disabled
                     } else {
                         // operation failed
                     }
                 }
             } catch (SecurityException e) {
               Log.w(TAG, "Exception" + e);
             }
 

This Api for container application works since knox 2.4 only Method of unbinding the list of applications at container space(inside container) from the profile and EnterpriseBilling is disabled for that application list

 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
            EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
            KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
            List packageList = new ArrayList();
          //Add Inside Container Applications to this packageList
             try {
                 EnterpriseBillingPolicy policy = kcm.getEnterpriseBillingPolicy();
                 if(policy != null) {
                     boolean retVal = policy.unbindAppsFomProfile(packageList);  
                     if(retVal==true) {
                          // For given Container Application package list Enterprise Billing is disabled
                     } else {
                         // operation failed
                     }
                 }
             } catch (SecurityException e) {
               Log.w(TAG, "Exception" + e);
             }
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EBILLING" permission which has a protection level of signature.

Since
API level 13
KNOX 2.2
Multiuser Environment
User Scope

public boolean unbindVpnFromProfile (String ebProfileName, String vpnProfileName)

Since: API level 13

Deprecated in API level 33
NOTE: This API is not available since Android 12.

API to unbind VPN connection from the billing profile.

After invoking this API, the data traffic corresponding to this VPN connection (profile) will be routed over the default data connection and billed to user.

Parameters
ebProfileName the billing profile name
vpnProfileName the vpn profile name,may or may not be available at this time
Returns
  • true if successful, false in case of error
Throws
SecurityException If caller does not have required permissions.
Usage

This API will remove VPN connection detail from EnterpriseBilling

            EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
            try {
                EnterpriseBillingPolicy policy = ekm.getEnterpriseBillingPolicy();
                if(policy != null) {
                    boolean retVal = policy.unbindVpnFromProfile(ebProfileName,vpnProfileName);  
                    if(retVal==true) {
                        // VPN engine details is successfully removed
                    } else {
                        // Operation failed
                    }
                }
            } catch (SecurityException e) {
              Log.w(TAG, "Exception" + e);
            }
 
 
For Container:
 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
          EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
          KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
            try {
                EnterpriseBillingPolicy policy = kcm.getEnterpriseBillingPolicy();
                if(policy != null) {
                    boolean retVal = policy.unbindVpnFromProfile(ebProfileName,vpnProfileName);  
                    if(retVal==true) {
                        // VPN engine details is successfully removed
                    } else {
                        // Operation failed
                    }
                }
            } catch (SecurityException e) {
              Log.w(TAG, "Exception" + e);
            }
 
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EBILLING" permission which has a protection level of signature.

Since
API level 13
KNOX 2.2
Multiuser Environment
User Scope

public boolean updateProfile (EnterpriseBillingProfile ebProfile)

Since: API level 13

Deprecated in API level 33
NOTE: This API is not available since Android 12.

API to update an existing profile previously created by this Admin.

Parameters
ebProfile the profile
Returns
  • true if operation is accepted successfully, false if profile updation has failed
Throws
SecurityException If caller does not have required permissions.
Usage

If MDM wants to update any existing profile then this API can be used. All the previous values will be erased and it will be replaced with new profile value.

          EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
          try {
              EnterpriseBillingPolicy policy = ekm.getEnterpriseBillingPolicy();
              if(policy != null) {
                  EnterpriseBillingProfile ebProfile = policy.getProfileDetails(ebProfileName);
                   if(ebProfile != null) {
                      //make changes on ebProfile object
                      boolean retVal = policy.updateProfile(ebProfile);
                      if(retVal==true) {
                          // ebProfile is updated successfully
                      } else {
                          // ebProfile updation has failed
                      }
                  }
              }
          }
          catch (SecurityException e) {
              Log.w(TAG, "Exception" + e);
          }
 
For Container:
 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
          EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
          KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
          try {
              EnterpriseBillingPolicy policy = kcm.getEnterpriseBillingPolicy();
              if(policy != null) {
                  EnterpriseBillingProfile ebProfile = policy.getProfileDetails(ebProfileName);
                   if(ebProfile != null) {
                      //make changes on ebProfile object
                      boolean retVal = policy.updateProfile(ebProfile);
                      if(retVal==true) {
                          // ebProfile is updated successfully
                      } else {
                          // ebProfile updation has failed
                      }
                  }
              }
          }
          catch (SecurityException e) {
              Log.w(TAG, "Exception" + e);
          }
 

Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_EBILLING" permission which has a protection level of signature.

Since
API level 13
KNOX 2.2
Multiuser Environment
User Scope