尝试与 Facebook 分享视频 link,但它显示未安装 Facebook 应用程序
Trying to share the video link with facebook but it is showing Facebook App not installed
share_intent = new Intent(Intent.ACTION_SEND);
share_intent.setType("text/plain");
share_intent.setPackage("com.facebook");
share_intent.putExtra(Intent.EXTRA_TEXT, "https://www.youtube.com/watch?v=" + videoid);
try {
mContext.startActivity(share_intent);
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(mContext,"Facebook have not been installed.",Toast.LENGTH_SHORT).show();
}
我正在尝试将我的应用程序中的 YouTube 视频 link 分享到 Facebook 应用程序,但是当我按下 Facebook 分享按钮时,它显示 Facebook 尚未安装。
帮我找到解决办法。
任何帮助将不胜感激。谢谢!
share_intent.setPackage(share_appname);
: share_appname
应包含应用程序的 pcakage 名称,您要处理的意图。正如您在评论中所说,您使用 com.facebook
作为包名,但 facebook 应用程序具有不同的包名:com.facebook.katana
。您可以在应用程序的 google 播放市场页面(在网络浏览器中)查看包名称:https://play.google.com/store/apps/details?id=com.facebook.katana
share_intent = new Intent(Intent.ACTION_SEND);
share_intent.setType("text/plain");
share_intent.setPackage("com.facebook");
share_intent.putExtra(Intent.EXTRA_TEXT, "https://www.youtube.com/watch?v=" + videoid);
try {
mContext.startActivity(share_intent);
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(mContext,"Facebook have not been installed.",Toast.LENGTH_SHORT).show();
}
我正在尝试将我的应用程序中的 YouTube 视频 link 分享到 Facebook 应用程序,但是当我按下 Facebook 分享按钮时,它显示 Facebook 尚未安装。
帮我找到解决办法。 任何帮助将不胜感激。谢谢!
share_intent.setPackage(share_appname);
: share_appname
应包含应用程序的 pcakage 名称,您要处理的意图。正如您在评论中所说,您使用 com.facebook
作为包名,但 facebook 应用程序具有不同的包名:com.facebook.katana
。您可以在应用程序的 google 播放市场页面(在网络浏览器中)查看包名称:https://play.google.com/store/apps/details?id=com.facebook.katana