将我的应用程序 link 从我的 android 应用程序共享到其他应用程序无法正常工作
sharing my app link to other apps from my android app is not working
我有下面的代码供 android 与其他应用程序共享应用程序,例如 facebook、twitter、whatsapp ot watever。
正在打开对话框并显示应用程序以选择任何人,但是当我选择应用程序时它给我消息共享失败,请稍后再试
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("plain/text");
shareIntent.putExtra(Intent.EXTRA_TEXT, mWebView.getUrl());
startActivity(Intent.createChooser(shareIntent, "share_with"));
试试这个
startActivity(new Intent(Intent.ACTION_SEND).setType("text/plain").putExtra(Intent.EXTRA_TEXT, mWebView.getUrl()));
或在您的代码中写入 text/plain(第 2 行)
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 this cool Sticker App at: https://play.google.com/store/apps/details?id=" + appPackageName);
sendIntent.setType("text/plain");
context.startActivity(sendIntent);
}
我有下面的代码供 android 与其他应用程序共享应用程序,例如 facebook、twitter、whatsapp ot watever。
正在打开对话框并显示应用程序以选择任何人,但是当我选择应用程序时它给我消息共享失败,请稍后再试
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("plain/text");
shareIntent.putExtra(Intent.EXTRA_TEXT, mWebView.getUrl());
startActivity(Intent.createChooser(shareIntent, "share_with"));
试试这个
startActivity(new Intent(Intent.ACTION_SEND).setType("text/plain").putExtra(Intent.EXTRA_TEXT, mWebView.getUrl()));
或在您的代码中写入 text/plain(第 2 行)
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 this cool Sticker App at: https://play.google.com/store/apps/details?id=" + appPackageName);
sendIntent.setType("text/plain");
context.startActivity(sendIntent);
}