
当我尝试通过官方Facebook App打开Facebook个人资料时,出现以下错误:载入传记时出错,内容不可用.@H_301_1@我尝试了许多代码,但一无所获.仅当设备上未安装Facebook App时,浏览器才能正常工作.
这是当前代码:
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); }更新:
当我放弃并且只输入https URI时,AndroID让我在Facebook APP和浏览器之间进行选择,我喜欢它!所以我的问题得到了回答= D
解决方法:
那天我遇到了类似的问题,发现当我尝试使用与您相同的方法时,只有当我想查看自己的个人资料(或Facebook应用程序中当前登录的用户)时,该方法才有效,但是无论何时我试图显示别人的Facebook页面,所以我最终遇到了这个答案:
https://stackoverflow.com/a/24547437/1879664
长话短说,这不再可行,到目前为止,唯一的解决方法是让Facebook像您提到的那样在Facebook内部加载网页,但是区别在于,如果用户无法在应用程序之间进行选择或拥有已经选择其他浏览器作为默认应用,则无法再通过Facebook打开该页面.使用此代码,您可以确保它始终会通过facebook应用程序打开该页面(如果已安装),或者它将使用您的默认浏览器加载.这是我在应用程序中使用的代码:
try { mActivity.getPackageManager().getPackageInfo("com.facebook.katana", 0); String url = "https://www.facebook.com/profile.PHP?ID=USER_ID" Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://facewebmodal/f?href="+url)); } mActivity.startActivity(intent); } catch (Exception e) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/profile.PHP?ID=USER_ID")); mActivity.startActivity(intent); e.printstacktrace(); } 总结 以上是内存溢出为你收集整理的打开Facebook用户个人资料Android全部内容,希望文章能够帮你解决打开Facebook用户个人资料Android所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)