gpt4 book ai didi

java - 安装 Facebook 应用程序后无法链接到 Facebook 个人资料页面

转载 作者:太空宇宙 更新时间:2023-11-04 14:17:05 25 4
gpt4 key购买 nike

安装 Facebook 应用程序后,我很难链接到 Facebook 个人资料页面。它说该页面不可用。当未安装 facebook 应用程序(使用浏览器打开)时,一切正常。有什么想法吗?

public static Intent getFBIntent(Context context, String facebookId) {
try {
// Check if FB app is even installed
context.getPackageManager().getPackageInfo("com.facebook.katana", 0);
String facebookScheme = "fb://profile/" + facebookId; //also tried with /page
Log.d("FB_LINK", facebookScheme);
return new Intent(Intent.ACTION_VIEW, Uri.parse(facebookScheme));
}
catch(Exception e) {
// Cache and Open a url in browser
String facebookProfileUri = "https://www.facebook.com/" + facebookId;
return new Intent(Intent.ACTION_VIEW, Uri.parse(facebookProfileUri));
}
}

最佳答案

试试这个

public static void openFacebookProfile(Context context,String userProfileLink) {
Intent facebookIntent = null;

try {
//If facebook app is installed
facebookIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse("fb://facewebmodal/f?href=" + userProfileLink));

} catch (Exception e) {
//Open in browser
facebookIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse(userProfileLink));
}

context.startActivity(facebookIntent);
}

您可以从graph api获取用户个人资料链接。

关于java - 安装 Facebook 应用程序后无法链接到 Facebook 个人资料页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27591767/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com