我想知道是否可以制作一个可以使用包名称启动任何应用程序(假设用户已安装)的按钮,我不认为有可能,但有人可能知道如何做。
document.location.href = 'intent:#Intent;scheme=app_scheme;package=app_package;end;';
我尝试过一两件事,但没有其他有效的方法
按钮 launchButton = findViewById(R.id.launchButton);
launchButton.setOnClickListener(new View.OnClickListener() { 公共无效onClick(查看视图){ String 包名 = "exampleapp"; // 替换为目标应用程序的包名
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(packageName);
if (launchIntent != null) {
startActivity(launchIntent);
} else {
// Handle the case where the target app is not installed
Toast.makeText(getApplicationContext(), "App not installed", Toast.LENGTH_SHORT).show();
}
}
});