首页 > 解决方案 > 如何使用 android studio Java 获得 ssh 会话?

问题描述

我正在开发一个需要启动 ssh 会话和运行命令的 android 应用程序,我听说过 JSH,它似乎正是我需要的,但不确定如何与 android 一起使用它工作室 - 任何人都可以帮忙吗?

提供更多上下文 - 我的应用程序是一个指纹解锁客户端,旨在与 Linux 桌面一起使用

我的相关代码是这样的:

       Button authenticate = findViewById(R.id.authenticate);
    final MainActivity activity = this;
    authenticate.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            biometricPrompt.authenticate(new CancellationSignal(), executor, new BiometricPrompt.AuthenticationCallback() {
                @Override
                public void onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result) {
                    activity.runOnUiThread(new Runnable() {
                        @Override
                        public void run() {

                            Toast.makeText(MainActivity.this, "Unlocked", Toast.LENGTH_SHORT).show();
                            //I assume this is where the ssh stuff would go
                        }
                    });

                }
            });
        }
    });
}

标签: javaandroidandroid-studio

解决方案


推荐阅读