How to Connect and Disconnect Using Intents

How to Connect using Intents

In order for a 3rd party application to start 2X Client activity, the following guide needs to be followed. An Intent needs to be created with which an Activity needs to be started. The action of the Intent should be set to Intent.ACTION_MAIN as shown below:

Intent i = new Intent(Intent.ACTION_MAIN);

The component name for the intent will need to be that of the activity that needs to be targeted, in particular the ActFarmsList activity.

ComponentName comp = new ComponentName("com.tux.client",  "com.tux.client.menus.ActFarmsList");

i.setComponent(comp);

The Intent extras must contain the connection details needed to launch a connection. Not all settings are mandatory.. If we were to send an intent using only the minimum required information it would look something like this.

Intent i = new Intent(Intent.ACTION_MAIN);

ComponentName comp = new ComponentName("com.tux.client","com.tux.client.menus.ActFarmsList");

i.setComponent(comp);

i.putExtra("External_Launch", true);

i.putExtra("Save", false);

i.putExtra("Server", "192.177.1.2");

i.putExtra("UserName", "myUser@domain ");

startActivity(i);

How to Disconnect using Intent

To disconnect a session the following parameter must be added in the intent extras.

Example of a disconnect intent

Intent i = new Intent(Intent.ACTION_MAIN);
ComponentName comp = new ComponentName("com.tux.client","com.tux.client.menus.ActFarmsList");
i.setComponent(comp);
i.putExtra("External_Launch", true);
i.putExtra("Disconnect", true);