当我尝试通过官方 Facebook 应用程序打开 Facebook 个人资料时,出现此错误:加载传记时出错,内容不可用。我尝试了很多代码,但没有。仅当设备上未安装 Facebook 应用程序时,浏览器才能正常工作。这是当前的代码:
try
{
Intent followIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/"+id_facebook));
startActivity(followIntent);
final Handler handler = new Handler();
handler.postDelayed(new Runnable()
{
@Override
public void run() {
Intent followIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/"+id_facebook));
startActivity(followIntent);
}
}, 1000 * 2);
}
catch (Exception e)
{
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/"+id_facebook)));
String errorMessage = (e.getMessage()==null)?"Message is empty":e.getMessage();
Log.e("Unlock_ScreenActivity:FacebookAppNotFound" ,errorMessage);
}
Run Code Online (Sandbox Code Playgroud)
更新:
当我放弃只放https URI时,Android让我在Facebook APP和浏览器之间进行选择,我喜欢它!所以我的问题得到了回答=D