如何让用户能够使用多个通信应用程序共享应用程序?

how can I make user able to share app using more than one communication app?

当我使用以下代码时,用户能够 select 一次通信应用程序(例如 WhatsApp),以共享该应用程序 link。 下一次此通信应用程序默认 selected,用户无法选择 select 任何其他通信应用程序。

public static void shareApp(Context context) {
final String appPackageName = context.getPackageName();
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
sendIntent.putExtra(Intent.EXTRA_TEXT, "Check cool App at:" +"https://play.google.com/store/apps/details?id=" + appPackageName);
sendIntent.setType("text/plain");
context.startActivity(sendIntent);
}

您想使用选择器意图:

String title = "Your Chooser Title"
context.startActivity(Intent.createChooser(sendIntent, title));