External Intents on Android External Intents on Android

External Intents on Android

Dmitry Machulo Dmitry Machulo

With the help of an intent, an Android app developer can open Termius from within his or her app and auto-fill details for a new host entry. It is possible to auto-fill the following details: connection type – ssh or telnet, username, hostname, port and password.

To open Termius and auto-fill connecting details, you will need to:

  1. create an intent,
  2. set intent action,
  3. add intent data to URI,
  4. start intent.

The intent given below as example passes the following connecting details: ssh as connection type, 'root' as username, '127.0.0.1' as hostname, '22' as port.

Intent intent = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.parse("ssh://root@127.0.0.1:22");
intent.setData(uri);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

To pass a password, use the putExtra method (on an additional line):

intent.putExtra("com.serverauditor.password", "pass");‌

Add comment

Please sign in to leave a comment.