External Intents on Android External Intents on Android

External Intents on Android

Anton Karpov Anton Karpov

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.

Comments

1 comment

  • Widhaprasa Waliprana

    How to add alias as well?

    Widhaprasa Waliprana
    0