Since: API level 17
public class

GlobalProxy

extends Object
java.lang.Object
   ↳ com.samsung.android.knox.net.GlobalProxy

Class Overview

This class provides APIs to set and get the device global proxy.

Since
API level 17
MDM 5.5

Summary

Public Methods
ProxyProperties getGlobalProxy()
API to get the information about the Global proxy.
int setGlobalProxy(ProxyProperties properties)
API to set a Global Proxy on the device.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public ProxyProperties getGlobalProxy ()

Since: API level 17

API to get the information about the Global proxy.

Returns
  • ProxyProperties object describing the current Global Proxy, or null in case there is no Global Proxy set.
Throws
SecurityException If caller does not have required permissions
Usage
Administrator should call this API to retrieve a ProxyProperties object containing all information about the Global Proxy current configured on the device.


 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 GlobalProxy globalProxy = edm.getGlobalProxy();

 ProxyProperties proxyProperties;

 try {

     proxyProperties = globalProxy.getGlobalProxy();

 } catch (SecurityException e) {

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

 }

 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_GLOBALPROXY" permission which has a protection level of signature.
Since
API level 17
MDM 5.5
Multiuser Environment
Global Scope

public int setGlobalProxy (ProxyProperties properties)

Since: API level 17

API to set a Global Proxy on the device.

Parameters
properties ProxyProperties object with proxy information. Use null to remove global proxy.
Returns
  • 1 if policy was successfully set; 0 otherwise.
Throws
SecurityException If caller does not have required permissions
Usage
Administrator will be able to set a Global Proxy on the device. Such proxy will work both for Wifi and Data connections. This proxy may not be considered by some applications (e.g. applications that directly open a socket with the final server), although it is used by most of them. Applications might retry connections without using the global proxy whenever the proxy is unreachable or the authentication fails.

 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);

 GlobalProxy globalProxy = edm.getGlobalProxy();

 try {

     // 1. static proxy configuration

     String hostName = "128.128.128.128";

     int portNumber = 80;



     List<String> exclusionList = new ArrayList<String>();

     exclusionList.add("102.103.22.202");

     exclusionList.add("www.samsung.com");



     ProxyProperties staticProxy = new ProxyProperties();

     staticProxy.setHostname(hostName);

     staticProxy.setPortNumber(portNumber);

     staticProxy.setExclusionList(exclusionList);



     // optional, set up authentication for the given static proxy

     staticProxy.setAuthConfigList(Arrays.asList(new AuthConfig[] {

           new AuthConfig("user", "pass")

     }));



     int resultStatic = globalProxy.setGlobalProxy(staticProxy);



     // 2. PAC proxy configuration

     String pacFileUrl = "http://128.128.128.128/proxy.pac";



     ProxyProperties automaticProxy = new ProxyProperties();

     automaticProxy.setPacFileUrl(pacFileUrl);



     // optional, set up authentication for the multiple proxies that could be returned in PAC file

     automaticProxy.setAuthConfigList(Arrays.asList(new AuthConfig[] {

           new AuthConfig("128.128.128.128", "3128", "user", "pass")

           new AuthConfig("128.128.128.128", "3129", "user1", "pass1")

           new AuthConfig("128.128.128.123", "3128", "user2", "pass2")

     }));



     int resultAutomatic = globalProxy.setGlobalProxy(automaticProxy);



 } catch (SecurityException e) {

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

 }

 
Permission
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_SECURITY" permission which has a protection level of signature. Moreover, this API also requires the caller to have the "com.samsung.android.knox.permission.KNOX_GLOBALPROXY" permission which has a protection level of signature.
Since
API level 17
MDM 5.5
Multiuser Environment
Global Scope
See Also