Menu

Remote injection

The Remote Injection module allows MDM providers to create end-to-end remote control solutions that transfer the device screen to a remote server. MDM agents can also inject mouse and keyboard events, sent to them from the remote server, into the device.

Remote injection APIs

Remote injection APIs are organized in the com.samsung.android.knox.remotecontrol package which provides classes that enable remote control features, allowing enterprises to remotely inject key/motion events.

The remote control APIs enable you to add the function to inject key, touch or trackball events to your MDM solution:

Remote injection examples

Device control API access

All device control APIs are accessed through the RemoteInjection class in the com.samsung.android.knox.remotecontrol package.

The API definition contains statements that:

The following example shows the statements (highlighted) that correspond to the parts of the definition:

EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
RemoteInjection remoteInjection = edm.getRemoteInjection();
try {
Int keycode = KeyEvent.KEYCODE_0;
remoteInjection.injectKeyEvents(new KeyEvent(KeyEvent.ACTION_DOWN, keycode), true);
} catch (SecurityException se) {
	Log.e(TAG, "Exception: " + se);
}

For more information on managing policies using APIs, see the topic Managing Policies on the Device Administration page on the Android Developer web site.

Remote injection debug and configure

The customer wants to use the remote control feature for remote debugging and configure all managed devices in a way that allows them to:

  • Simulate hard key presses
  • Start and stop application

1. Get RemoteInjection object

//Callback method - alias(String)
@Override
public void alias(String alias) {
PrivateKey pKey = KeyChain.getPrivateKey(alias);
X509Certificate[] certChain = KeyChain.getCertificateChain(alias);
}

2. Look at Settings, simulate the key presses, and start and stop an application:

remoteInjection.injectKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SETTINGS), true);
remoteInjection.injectKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK), true);
remoteInjection.injectKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_HOME), true);
remoteInjection.injectKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_CAMERA), true));
remoteInjection.injectKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK), true));